Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
August 15, 2006
In tip 10732, we used a script to alter a user's screen saver and wallpaper settings.
I have scripted WPSS.BAT to display the logged on user's screen saver and wallpaper settings without using the registry.
The syntax for using WPSS.BAT is:
WPSS
A sample output might look like:
Name: JSIINCJerryScreen Saver Active: TrueScreen Saver Executable: C:WINDOWSXEROXV~1.SCRScreen Saver Secure: TrueScreen Saver Timeout: 600Wallpaper: C:WINDOWSBGInfo.bmpWallpaper Stretched: TrueWallpaper Tiled: False
WPSS.BAT contains:
@echo offsetlocal EnableDelayedExpansionif exist "%TEMP%WPSS.VBS" goto :[email protected] Error Resume Next>"%TEMP%WPSS.VBS"@echo.strComputer = ".">>"%TEMP%WPSS.VBS"@echo.Set objWMIService = GetObject("winmgmts:" _>>"%TEMP%WPSS.VBS"@echo. ^& "{impersonationLevel=impersonate}!\" ^& strComputer ^& "rootcimv2")>>"%TEMP%WPSS.VBS"@echo.Set colItems = objWMIService.ExecQuery("Select * from Win32_Desktop")>>"%TEMP%WPSS.VBS"@echo.For Each objItem in colItems>>"%TEMP%WPSS.VBS"@echo. Wscript.Echo "Name: " ^& objItem.Name>>"%TEMP%WPSS.VBS"@echo. Wscript.Echo "Screen Saver Active: " ^& objItem.ScreenSaverActive>>"%TEMP%WPSS.VBS"@echo. Wscript.Echo "Screen Saver Executable: " ^& objItem.ScreenSaverExecutable>>"%TEMP%WPSS.VBS"@echo. Wscript.Echo "Screen Saver Secure: " ^& objItem.ScreenSaverSecure>>"%TEMP%WPSS.VBS"@echo. Wscript.Echo "Screen Saver Timeout: " ^& objItem.ScreenSaverTimeout>>"%TEMP%WPSS.VBS"@echo. Wscript.Echo "Wallpaper: " ^& objItem.Wallpaper>>"%TEMP%WPSS.VBS"@echo. Wscript.Echo "Wallpaper Stretched: " ^& objItem.WallpaperStretched>>"%TEMP%WPSS.VBS"@echo. Wscript.Echo "Wallpaper Tiled: " ^& objItem.WallpaperTiled>>"%TEMP%WPSS.VBS"@echo.Next>>"%TEMP%WPSS.VBS":doitset OK=Nfor /f "Tokens=1* Delims=:" %%s in ('cscript //nologo "%TEMP%WPSS.VBS"') do ( set title=%%s set answer=%%t set answer=!answer:~1! if "!title!" EQU "Name" If /i "!answer!" EQU "%USERDOMAIN%%UserName%" ( set OK=Y ) ELSE ( set OK=N ) if "!OK!" EQU "Y" @echo !title!: !answer!)endlocal
You May Also Like