Powershell: running command from windows console
start: cmd
C:\> powershell yourcommand
for example:
C:\>powershell dsquery user -samid username | dsget user -memberof | dsget group –samid
To find all groups of a user is memberof without the DN's
(http://msdn.microsoft.com/en-us/library/dd835506%28VS.85%29.aspx)
so usefull in vbscript:
to check if the current user is member of a group:
vbs code:
Dim oShell, oEnv, oFSO, here here = left(WScript.ScriptFullName,len(WScript.ScriptFullName)-len(WScript.ScriptName)-1)
'Retrieve current username:
'Name of the group to check
'Powershell command line
'Checking oCheckGrp
On Error GoTo 0 |
Commenter cet article