Hm. If you're lucky, the ScreenHeight and ScreenWidth properties of the Win32_DesktopMonitor WMI class will be filled out on the client, which means you can easily use a VB script or Powershell script to determine the computer's desktop resolution.
Get-WMIObject Win32_DesktopMonitor
Now that you know the computer's resolution, you can set the appropriate wallpaper like so. Credits to the author of the following script are in the comments:
#requires -version 2.0
## Set-Wallpaper - set your windows desktop wallpaper
###################################################################################################
## Usage:
## Set-Wallpaper "C:\Users\Joel\Pictures\Wallpaper\Dual Monitor\mandolux-tiger.jpg" "Tile"
## ls *.jpg | get-random | Set-Wallpaper
## ls *.jpg | get-random | Set-Wallpaper -Style "Stretch"
###################################################################################################
## History:
## v0.5 First release (on #PowerShell@irc.freenode.net)
## v1.0 Public release (http://www.poshcode.org/488)
## - Added Style: Tile|Center|Stretch
## v1.1 This Release
## - Added "NoChange" style to just use the style setting already set
## - Made the Style parameter to the cmdlet optional
###################################################################################################
add-type @"
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace Wallpaper
{
public enum Style : int
{
Tile, Center, Stretch, NoChange
}
public class Setter {
public const int SetDesktopWallpaper = 20;
public const int UpdateIniFile = 0x01;
public const int SendWinIniChange = 0x02;
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern int SystemParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni);
public static void SetWallpaper ( string path, Wallpaper.Style style ) {
SystemParametersInfo( SetDesktopWallpaper, 0, path, UpdateIniFile | SendWinIniChange );
RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true);
switch( style )
{
case Style.Stretch :
key.SetValue(@"WallpaperStyle", "2") ;
key.SetValue(@"TileWallpaper", "0") ;
break;
case Style.Center :
key.SetValue(@"WallpaperStyle", "1") ;
key.SetValue(@"TileWallpaper", "0") ;
break;
case Style.Tile :
key.SetValue(@"WallpaperStyle", "1") ;
key.SetValue(@"TileWallpaper", "1") ;
break;
case Style.NoChange :
break;
}
key.Close();
}
}
}
"@
cmdlet Set-Wallpaper {
Param(
[Parameter(Position=0, Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias("FullName")]
[string]
$Path
,
[Parameter(Position=1, Mandatory=$false)]
[Wallpaper.Style]
$Style = "NoChange"
)
[Wallpaper.Setter]::SetWallpaper( (Convert-Path $Path), $Style )
}
Notice that you have to P/Invoke user32.dll to set wallpaper, which may mean VB script might not be able to accomplish this.
Here's a much shorter, simpler way to do it, although it will probably require a logoff/logon to take effect:
Function Set-WallPaper($Value)
{
Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $value
rundll32.exe user32.dll, UpdatePerUserSystemParameters
}
Method 2: Also, you can use GPO WMI filters on the same WMI class, and set a different wallpaper based on the results of that WMI filter. So for instance, you could either host all the variably-sized wallpapers on a network share, or you could use Group Policy to prestage all the wallpapers on each client. Then, make one GPO for each different size of wallpaper, and set the WMI filter on it to apply only if Win32_DesktopMonitor.ScreenWidth = 1920, and so on.