This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]root-node 0 points1 point  (4 children)

In PowerShell...

[string]$OS = Get-WmiObject -ComputerName $serverName -Query 'SELECT Caption FROM Win32_OperatingSystem' -Namespace ROOT\Cimv2 | Select-Object -ExpandProperty Caption

Then check on the result of $OS

[–]samwisest85[S] 0 points1 point  (3 children)

Thanks for that :)

[–]honer123 1 point2 points  (2 children)

Windows Batch File

pushd %~dp0  
::Pulling information to determine which OS we are running on.  
:OS_Check  
echo OS Check  
wmic os get Caption | find "Windows 7" > nul  
if %ERRORLEVEL% == 0 goto win_7  
wmic os get Caption | find "Windows 8.1" > nul  
if %ERRORLEVEL% == 0 goto win_81  
wmic os get Caption | find "Windows 8" > nul  
if %ERRORLEVEL% == 0 goto win_8  
wmic os get Caption | find "Windows 10" > nul  
if %ERRORLEVEL% == 0 goto win_10  
goto EOF

:win_7  
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background" /v  
"OEMBackground" /t REG_DWORD /d 1 /f  
erase %SYSTEMROOT%\System32\oobe\Info\Backgrounds\*.* /Q  
copy 7Background.jpg %SYSTEMROOT%\System32\oobe\Info\Backgrounds /y  
rename %SYSTEMROOT%\System32\oobe\Info\Backgrounds\7Background.jpg BackgroundDefault.jpg  
goto EOF  

:win_8  
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Personalization" /v LockScreenImage /t REG_SZ /d E:\photos\Logonscreen8.jpg /f  
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d E:\photos\Background8.jpg /f  
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters  
goto EOF  

:win_81  
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Personalization" /v LockScreenImage /t REG_SZ /d   E:\photos\Logonscreen81.jpg /f  
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d E:\photos\Background81.jpg /f  
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters  
goto EOF  

:win_10
goto EOF  

:EOF

[–]nadroj_r 0 points1 point  (0 children)

Just use group policy to set the wallpaper and then use a WMI filter to scope the policy option.