Jump to content

Recommended Posts

Posted

Hi all,

I found the key in the registry that causes Control Panel to be seen either through the Classic View or the Category View, without using that "ForceClassicControlPanel" sequence, because I would lose the ability to single-click on the control panel to switch between category and classic view.

However, it implies on identifying the SID generated by Windows XP.

I have even found programs which expose the SID and export it to a text file in a single line like that:

S-1-5-21-blah blah blah...

Question: is there a way to read that text file and "compose" a string?

I would have:

[HKEY_USERS\the_SID_string\Software\Microsoft\Windows\CurrentVersion\Explorer\WebView\BarricadedFolders]
"shell:ControlPanelFolder"=dword:00000000 (0=classic view; 1=category view)

...So that I could prepare an unattended Windows XP installation CD with that tweak.

Better yet, what I'd really want is a way to directly extract SID from the registry without having to read any text file generated by any program.

Thanks,

Peron


Posted

why not just use HKCU and apply the tweaks from cmdlines.txt? Or if you want to apply it after windows is installed write a logon script that uses HKCU?

Posted

I would prefer ro use wmic, however the following should work

@ECHO OFF&SETLOCAL ENABLEEXTENSIONS
FOR /F "TOKENS=*" %%a IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /S^|FINDSTR "S-1-5-"') DO (
FOR /F "TOKENS=3 DELIMS= " %%b IN ('REG QUERY "%%~a" /V "ProfileImagePath"') DO (
IF ERRORLEVEL 0 (
ECHO/%%~b|FIND "%USERPROFILE%">NUL
IF ERRORLEVEL 0 SET UserSID=%%a
)
)
)
IF NOT DEFINED UserSID ECHO/ SID not found&&PAUSE&ENDLOCAL&GOTO :EOF
SET UserSID=%UserSID:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\=%
REG ADD HKU\%UserSID%\Software\Microsoft\Windows\CurrentVersion\Explorer\WebView\BarricadedFolders /V "shell:ControlPanelFolder" /T REG_DWORD /D 0 /F
ECHO/ Your Registry Key was set using the following profile&ECHO/ %UserSID%&PAUSE&ENDLOCAL&GOTO :EOF

where delims=<tab>

Posted (edited)

Here a VBS script that makes a text file with all the user accounts info.

Save As UserAccountInfo.VBS

Dim Act, Fso, Break, Ts, VarLoc, S_5 :  S_5 = Space(5) : strComputer = "."
Set Act = CreateObject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
Break = Chr(171)& "-----------------------------------------"& Chr(187)
With Act
VarLoc = Array(.ExpandEnvironmentStrings("%USERPROFILE%\Desktop"),.CurrentDirectory,_
.ExpandEnvironmentStrings("%UserName%"),.ExpandEnvironmentStrings("%USERPROFILE%\Desktop\AccountReport.txt"))
End With

Set Ts = Fso.CreateTextFile(VarLoc(3))
Ts.WriteLine S_5 & Date() & " < ----- > " & Time() & " < ----- > " &_
"User Running The script : " & VarLoc(2) & vbCrLf & S_5 & "Script Ran From : " & VarLoc(1) & vbCrLf & S_5 & Break
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_UserAccount Where LocalAccount = True")

For Each objItem in colItems
Ts.WriteLine S_5 & "Account Type: " & objItem.AccountType & vbCrLf & S_5 & "Caption: " & objItem.Caption
Ts.WriteLine S_5 & "Description: " & objItem.Description & vbCrLf & S_5 & "Disabled: " & objItem.Disabled
Ts.WriteLine S_5 & "Domain: " & objItem.Domain & vbCrLf & S_5 & "Full Name: " & objItem.FullName
Ts.WriteLine S_5 & "Local Account: " & objItem.LocalAccount & vbCrLf & S_5 & "Lockout: " & objItem.Lockout
Ts.WriteLine S_5 & "Name: " & objItem.Name & vbCrLf & S_5 & "Password Changeable: " & objItem.PasswordChangeable
Ts.WriteLine S_5 & "Password Expires: " & objItem.PasswordExpires
Ts.WriteLine S_5 & "Password Required: " & objItem.PasswordRequired
Ts.WriteLine S_5 & "SID: " & objItem.SID & vbCrLf & S_5 & "SID Type: " & objItem.SIDType
Ts.WriteLine S_5 & "Status: " & objItem.Status & vbCrLf & S_5 & Break
Next
Ts.Close
Act.Run(Chr(34) & VarLoc(3) & Chr(34))

Edited by gunsmokingman
Posted

Thank you all in the first place for your tips.

Yzöwl,

it seems you provided a solution where you search several keys in the registry for the one which matches what I need. You looked for "S-1-5-" and such research returns many entries.

However, if I could only look for "S-1-5-21", I'd find one entry only.

Is it possible to simplify that piece of code? I'm having a hard time trying to understand it fully.

Thank you in advance,

Peron

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...