Solved query user account sid with wmic


shoober420

Active member
Member
Local time
6:10 AM
Posts
158
OS
Windows 11 27783
im trying to put together this string to query the account sid with wmic to apply it to a reg key. what part is wrong?

Code:
for /f %%i in ('wmic useraccount where name='%username%' get sid^) do (

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SystemProtectedUserData\%%i\AnyoneRead\Colors" /v /v "AccentColor" /t REG_DWORD /d "0xff446ea5" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SystemProtectedUserData\%%i\AnyoneRead\Colors" /v /v "StartColor" /t REG_DWORD /d "0xff446ea5" /f

)

PAUSE
 
Last edited:

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
Current user
Code:
wmic useraccount where name='%username%' get domain,name,sid

All users

Code:
wmic useraccount get domain,name,sid
 

My Computer

System One

  • OS
    Windows 11 Pro
1.webp
 

My Computer

System One

  • OS
    Microsoft Windows 11 Home
    Computer type
    PC/Desktop
    Manufacturer/Model
    MSI MS-7D98
    CPU
    Intel Core i5-13490F
    Motherboard
    MSI B760 GAMING PLUS WIFI
    Memory
    2 x 16 Patriot Memory (PDP Systems) PSD516G560081
    Graphics Card(s)
    GIGABYTE GeForce RTX 4070 WINDFORCE OC 12G (GV-N4070WF3OC-12GD)
    Sound Card
    Bluetooth Аудио
    Monitor(s) Displays
    INNOCN 15K1F
    Screen Resolution
    1920 x 1080
    Hard Drives
    WD_BLACK SN770 250GB
    KINGSTON SNV2S1000G (ELFK0S.6)
    PSU
    Thermaltake Toughpower GF3 1000W
    Case
    CG560 - DeepCool
    Cooling
    ID-COOLING SE-224-XTS / 2 x 140Mm Fan - rear and top; 3 x 120Mm - front
    Keyboard
    Corsair K70 RGB TKL
    Mouse
    Corsair KATAR PRO XT
    Internet Speed
    100 Mbps
    Browser
    Firefox
    Antivirus
    Microsoft Defender Antivirus
    Other Info
    https://www.userbenchmark.com/UserRun/66553205
This is to add wmic as needed:

 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
I know where this is headed, and "AnyoneRead\Colors" is the wrong approach.

You're tackling a customization by looking at the bottom level, instead of using a top-level process. Research how to create themes and apply them. And you'll find Windows will often ignore your specific AccentColor because it's not "contrast-y" when compared with the other UI palette colors.
 

My Computer

System One

  • OS
    Windows 7
i decided to move accent colors to a seperate script


im getting closer to getting the string correct

Code:
for /f "tokens=2 delims=^=" %%i in ('wmic useraccount where name='%username%' get sid^| findstr "S-"') do (

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SystemProtectedUserData\%%i\AnyoneRead\Colors" /v "AccentColor" /t REG_DWORD /d "0xff446ea5" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SystemProtectedUserData\%%i\AnyoneRead\Colors" /v "StartColor" /t REG_DWORD /d "0xff446ea5" /f

)

PAUSE

when i run this, i get this error message

Code:
shoober420 - Invalid alias verb

if i run the string seperate, it does output the user account sid properly. how can i get the output to %%i for the reg key?
 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
i made a discovery. those reg keys werent responsible for changing the accent color. it was the reg key "AccentPalette". its binary, so i had figure out each binary value of each color in the script.
 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
Back
Top Bottom