Set WshShell = CreateObject("Wscript.Shell")
Set fso = Wscript.CreateObject("Scripting.FilesystemObject")
fName = WshShell.SpecialFolders("Desktop") & "\SID.txt"
Set b = fso.CreateTextFile(fName, true)
b.writeblanklines 1
b.writeline string(80,"*")
b.writeblanklines 1
b.writeline "Lista kont, identyfikatorów SID i ścieżek dostępu."
b.writeblanklines 1
b.writeline string(80,"*")
b.writeblanklines 1
b.writeblanklines 1
strProfileBranch = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAccounts = objWMIService.ExecQuery _
("Select * From Win32_UserAccount")
For Each objAccount in colAccounts
If objAccount.Name = "HelpAssistant" or objAccount.Name = "SUPPORT_388945a0" then
else
b.writeline "Nazwa użytkownika : " & objAccount.Name
b.writeline "SID : " & objAccount.SID
b.writeline "Katalog profilu : " & GetHomePath(objAccount.SID)
b.writeblanklines 1
end if
Next
Function GetHomePath(strSID)
On Error Resume Next
GetHomePath = WshShell.ExpandEnvironmentStrings(Trim(WshShell.RegRead (strProfileBranch & strSID & "\ProfileImagePath")))
On Error Goto 0
End Function
b.writeline string(80,"*")
b.close
WshShell.Run "notepad.exe " & fName
Set fso = Nothing
set Wshshell = Nothing