I tried to change my wallpaper with your command but it didn't work until I ran this: rundll32.exe user32.dll, UpdatePerUserSystemParameters. Even then, it only worked intermittently (it's a know issue on Win7).
Anyways, I have written a getfile function for PowerShell that downloads a source url to the disk.
function getfile($url, $filename)
{
$wc = New-Object System.Net.WebClient
Register-ObjectEvent -InputObject $wc -EventName DownloadProgressChanged -SourceIdentifier WebClient.DownloadProgressChanged -Action { Write-Progress -Activity "Downloading: $($EventArgs.ProgressPercentage)% Completed" -Status $url -PercentComplete $EventArgs.ProgressPercentage; }
Register-ObjectEvent -InputObject $wc -EventName DownloadFileCompleted -SourceIdentifier WebClient.DownloadFileComplete -Action { Write-Host "Download Complete - $filename"; Unregister-Event -SourceIdentifier WebClient.DownloadProgressChanged; Unregister-Event -SourceIdentifier WebClient.DownloadFileComplete; }
try
{
$wc.DownloadFileAsync($url, $filename)
}
catch [System.Net.WebException]
{
Write-Host("Cannot download $url")
}
finally
{
$wc.Dispose()
}
}
You can find it and a simpler version here along with a detailed description of what it is doing.
You should be able to change your wallpaper with some thing like this:
$url = "http://fc05.deviantart.net/fs30/f/2008/062/9/4/Serenity_WPP3___1920_Preview_by_nuaHs.jpg"
$filename = "d:\serenity.jpg"
getfile $url $filename
set-itemproperty -path "HKCU:Control Panel\Desktop" -name WallPaper -value $filename
rundll32.exe user32.dll, UpdatePerUserSystemParameters