Skip navigation

JSI Tip 9737. How can I list the wallpaper configured for each user of a computer?


Using Reg.exe from the Windows 2000 Support Tools, or Reg.exe that is built into Windows XP and later, and SidToName.exe freeware, I have scripted WhatWallPaper.bat to return the computer name, user name, and wallpaper that is configured in the Wallpaper Value Name at "\\ComputerName\HKU\<SID>\Control Panel\Desktop" for each user of a computer.

The syntax for using WhatWallPaper.bat is:

WhatWallPaper \[ComputerName1 ComputerName2 ... ComputerNameN

Where each ComputerNameX is optional.

WhatWallPaper.bat contains:

@echo off
setlocal ENABLEDELAYEDEXPANSION
if \{%1\}

\{\} set comp=\\%computername%\&set cmp=%computername%\&goto doit :again if \{%1\}

\{\} endlocal&goto :EOF set comp=%1 set cmp=%comp:\=% set comp=\\%cmp%shift :doit for /f "Tokens=*" %%a in ('reg query "%comp%HKU"^|find "\"') do ( set user=%%a set user=!user:HKEY_USERS=HKU! set sid=!user:HKU\=! set wp=NONE set usr=NONE call :getwp>nul 2>&1 if "!wp!" NEQ "NONE" @echo "%cmp%","!usr!","!wp!" ) goto again :getwp for /f "Tokens=2*" %%b in ('reg query "%comp%!user!\Control Panel\Desktop" /V Wallpaper^|find "REG_SZ"^|find /v /i "(None)"') do ( set wp=%%c ) if \{%wp%\} NEQ \{\} set wp=%wp:"=% if "%wp%" EQU "" set wp=NONE&goto :EOF if "%wp%" EQU "NONE" goto :EOF for /f "Tokens=*" %%x in ('call SIDtoName !sid! %comp%') do ( set usr=%%x )



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish