This is based on what we use in our production environment.
It retrieves the resolution, checks if matching wallpaper exists on the server. If it does it checks if it exists locally, if not copy it. If it exists locally it checks the file time of the local file and the one on the server if they are different copy it and after all check and copying is done it sets it as the wallpaper. The last four lines set the display mode of the wallpaper.

 Code:
;Get the current screen resolution using WMI.
$wmiColl = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_DesktopMonitor")
For Each $wmiObj in $wmiColl
	;Check if the found resolution is for the primary monitor.
	If $wmiObj.DeviceID = "DesktopMonitor1"
		;Combine width and height.
		$screenres = CStr($wmiObj.ScreenWidth) + "x" + CStr($wmiObj.ScreenHeight)
	EndIf
Next

;Set wallpaper for regular computers and users.
If Exist(@LDRIVE + "wallpaper\Wallpaper" + $screenres + ".bmp")
	;Copy wallpaper from the server when a local copy does not exist.
	If Not Exist("C:\localfolder\Wallpaper\Wallpaper" + $screenres + ".bmp")
		Copy @LDRIVE + "wallpaper\Wallpaper" + $screenres + ".bmp" "C:\localfolder\Wallpaper\*.*"
	Else
		;Get the timestamp of the local and remote wallpaper.
		$local = GetFileTime("C:\localfolder\Wallpaper\Wallpaper" + $screenres + ".bmp")
		$logon = GetFileTime(@LDRIVE + "wallpaper\Wallpaper" + $screenres + ".bmp")
		;If the timestamps do not match copy the wallpaper from the server. The server is leading.
		If $local <> $logon
			Copy @LDRIVE + "wallpaper\Wallpaper" + $screenres + ".bmp" "c:\localfolder\wallpaper\*.*"
		EndIf
	EndIf
	;Set the wallpaper.
	$rc = SetWallpaper ("C:\localfolder\Wallpaper\Wallpaper" + $screenres + ".bmp", 1)
	;Set the way the wallpaper is displayed.
	;Stretched: WallpaperStyle = 2, TileWallpaper = 0.
	;Centered: WallpaperStyle = 0, TileWallpaper = 0.
	;Tiled: WallpaperStyle = 0, TileWallpaper = 1.
	$rc = WriteValue("HKU\" + @SID + "\Control Panel\Desktop", "TileWallpaper", "0", "REG_SZ")
	$rc = WriteValue("HKU\" + @SID + "\Control Panel\Desktop", "WallpaperStyle", "2", "REG_SZ")
	$rc = WriteValue("HKU\" + @SID + "\Software\Microsoft\Internet Explorer\Desktop\General", "TileWallpaper", "0", "REG_SZ")
	$rc = WriteValue("HKU\" + @SID + "\Software\Microsoft\Internet Explorer\Desktop\General", "WallpaperStyle", "2", "REG_SZ")
EndIf


Edited by Mart (2010-11-11 10:00 AM)
Edit Reason: Typo in the code. Thanks Arend.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.