arst06d
Programmer
- Nov 29, 2002
- 324
Hi
I need a script, runnable by all users, to simply display a list of all user groups they are a member of. Here's what I have been playing with so far:
I get displayed the userid & the domain but it throws an error on the GetObject line:
It will be run on XP machines.
Can anyone shed any light on this, or suggest a different approach?
Thanks
I need a script, runnable by all users, to simply display a list of all user groups they are a member of. Here's what I have been playing with so far:
Code:
Dim X
set X = createobject("WSCRIPT.Network")
dim U
U=x.UserName
MsgBox "Logged In User is: " & U
Set objNetwork = CreateObject("WScript.Network")
sDomain = objNetwork.UserDomain
MsgBox "sDomain: " & sDomain
sUser = objNetwork.UserName
MsgBox "sUser: " & sUser
'Set oUser = GetObject("WinNt://" & sDomain & "/" & sUser & ",user")
set oUser = GetObject("WinNT://" & sDomain & "/" & strUser)
MsgBox oUser
dim sGroups
For Each oGroup In oUser.Groups
sGroups = sGroups & oGroup.Name & vbcrlf
'End if
Next
MsgBox sGroups
I get displayed the userid & the domain but it throws an error on the GetObject line:
Code:
Script: h:\getcurrentuser.vbs
Line: 13
Char: 1
Error: 0x80005000
Code: 80005000
Source: (null)
It will be run on XP machines.
Can anyone shed any light on this, or suggest a different approach?
Thanks