Solved query user account sid with wmic


shoober420

Well-known member
Member
VIP
Local time
11:47 AM
Posts
231
OS
Windows 11 27965
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 My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.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 My Computer

At a glance

Windows 11 Pro
OS
Windows 11 Pro
1.webp
 

My Computer My Computer

At a glance

Microsoft Windows 11 HomeIntel Core i5-13490F2 x 16 Patriot Memory (PDP Systems) PSD516G56...GIGABYTE GeForce RTX 4070 WINDFORCE OC 12G (G...
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 6400MT (32-37-37-74); 1.35V)
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 My Computer

At a glance

Windows 10Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz16 GB Total: Manufacturer : Samsung MemoryTyp...NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
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 My Computer

At a glance

Windows 7
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 My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.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 My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420

Similar threads

Latest Support Threads

Back
Top Bottom