L
Liam
Hi All,
I'm trying to write a script to dump out the user
SID's from the registry. This will help when trying to
troubleshoot when a specific user's registry has gotten
corrupt or has a wrong value. When I try to run a script
to enumerate some values in HKEY_USERS I keep getting
values from HKEY_CURRENT_USER. The funny thing is that it
works on some machines and not on others. Here's my code.
Const HKEY_USERS = &H80000003
DIM UserKey
DIM subkey
DIM DWORDValue
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strComputer = "."
Set oReg=GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")
strKeyPath = ""
oReg.EnumKey HKEY_USERS, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
if right(subkey,7) <> "Classes" then
On Error Resume Next
UserKey = subkey
DWORDValue = WSHShell.RegRead
("HKEY_USERS\" & UserKey
& "\Software\Microsoft\Windows\CurrentVersion\Explorer\Logo
n User Name")
wscript.echo UserKey & " " & DWORDValue &
Chr(13)
End If
Next
wscript.echo "done"
WScript.Quit
I'd expect to see something like:
S-1-5-21-1659004503-1644491937-682003330-1798 bloggs_j
S-1-5-21-1659004503-1644491937-682003330-1799 man_i
S-1-5-21-1659004503-1644491937-682003330-2674 woman_u
But instead get:
AppEvents
Console
Control Panel
Environment
Identities
Keyboard Layout
Printers
Software
UNICODE
Program Groups
Windows 3.1 Migration Status
Volatile Environment
Any help would be greatly appreciated.
Thanks,
Liam.
I'm trying to write a script to dump out the user
SID's from the registry. This will help when trying to
troubleshoot when a specific user's registry has gotten
corrupt or has a wrong value. When I try to run a script
to enumerate some values in HKEY_USERS I keep getting
values from HKEY_CURRENT_USER. The funny thing is that it
works on some machines and not on others. Here's my code.
Const HKEY_USERS = &H80000003
DIM UserKey
DIM subkey
DIM DWORDValue
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strComputer = "."
Set oReg=GetObject("winmgmts:
{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")
strKeyPath = ""
oReg.EnumKey HKEY_USERS, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
if right(subkey,7) <> "Classes" then
On Error Resume Next
UserKey = subkey
DWORDValue = WSHShell.RegRead
("HKEY_USERS\" & UserKey
& "\Software\Microsoft\Windows\CurrentVersion\Explorer\Logo
n User Name")
wscript.echo UserKey & " " & DWORDValue &
Chr(13)
End If
Next
wscript.echo "done"
WScript.Quit
I'd expect to see something like:
S-1-5-21-1659004503-1644491937-682003330-1798 bloggs_j
S-1-5-21-1659004503-1644491937-682003330-1799 man_i
S-1-5-21-1659004503-1644491937-682003330-2674 woman_u
But instead get:
AppEvents
Console
Control Panel
Environment
Identities
Keyboard Layout
Printers
Software
UNICODE
Program Groups
Windows 3.1 Migration Status
Volatile Environment
Any help would be greatly appreciated.
Thanks,
Liam.