¿Por qué no puedo actualizar mi fondo de Windows 7 usando regedit?

No pude actualizar los detalles de esta publicación, así que escribo esto en la sección “Respuestas”

Estoy ejecutando un script de PowerShell que toma el fondo de pantalla diario de Bing y lo coloca en un archivo. Luego actualiza el valor del registro, pero no tendrá que afectar los cambios. Lo único que hará será personalizar y actualizar el fondo allí.

Guión

[CmdletBinding ()] Param (
[ValidateRange (0,18)] [int] $ Day = 0,
[ValidateSet (“en-US”, “en-IN”)] [string] $ Mkt = “en-US”
)
[int] $ Num = 1
[string] $ Dir = “C: \ Personal \ EmployeeID \ Pictures \ Wallpaper”
[cadena] $ Res = “_1920x1080”
[cadena] $ Bing = “Bing”
[string] $ XmlUrl = “$ ($ Bing) /HPImageArchive.aspx?format=xml&idx = $ ($ Day) & n = $ ($ Num) & mkt = $ ($ Mkt)”;
md -Force $ Dir *> $ null
$ Request = Invoke-WebRequest -Uri $ XmlUrl
[xml] $ Xml = $ Request.Content
[System.Uri] $ PicUrl = New-Object System.Uri “$ ($ Bing) $ ($ Xml.images.image.urlBase) $ ($ Res) .jpg”
$ Pic = “$ ($ Dir) \ $ ($ PicUrl.Segments [$ PicUrl.Segments.Count -1] .Split (” _ “) [0]). Jpg”
If (! (Test-Path $ Pic)) {
Invoke-WebRequest -Uri $ PicUrl -OutFile $ Pic
}
$ Pic = Resolve-Path -Path $ Pic
Set-ItemProperty -path ‘HKCU: \ Control Panel \ Desktop \’ -name wallpaper -value $ Pic
rundll32.exe user32.dll, UpdatePerUserSystemParameters
rundll32.exe user32.dll, UpdatePerUserSystemParameters
rundll32.exe user32.dll, UpdatePerUserSystemParameters
$ firma = @ ‘
[DllImport (“user32.dll”)]
public static extern uint SystemParametersInfo (
uint uiAction,
uint uiParam,
string pvParam,
uint fWinIni);
‘@

$ type = Add-Type -MemberDefinition $ signature `
-Nombre Win32Utils -Namespace SystemParametersInfo `
-Pasar a través de

$ null = $ type :: SystemParametersInfo (20, 0, $ file.FullName, 3)

“El papel de la pared ahora está configurado en $ ($ Pic)”