I got batch and VBS methods (see below) since I could not find the equivalent package or VBS method for this question elsewhere. If I do not add it to this stream (jscript), add a comment about how / where it should go, and I will remove this answer and post as indicated. :)
Package (one line - carriage return):
for /f "tokens=2*" %%f in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v ProfilesDirectory ^|find /i "Profiles"') do @set ProfDir=%%g
VBScript:
' http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/registry/#ListRegFiles.htm const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set StdOut = WScript.StdOut Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath,_ arrValueNames, arrValueTypes For i=0 To UBound(arrValueNames) ' StdOut.WriteLine "File Name: " & arrValueNames(i) & " -- " oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,_ arrValueNames(i),strValue ' StdOut.WriteLine "Location: " & strValue ' StdOut.WriteBlankLines(1) IF arrValueNames(i) = "ProfilesDirectory" THEN ProfileRoot= strValue Next wscript.echo("ProfileRoot=" & ProfileRoot)
Lizz
source share