I have a question: my ps1 is not running. Does anyone know why this is happening?
Start-Sleep -Seconds 10
# Copy to temp to ensure no spaces or access issues
Copy-Item "$env:USERPROFILE\Documents\Klantentools\pc.jpg" "$env:TEMP\pc.jpg" -Force
$wallpaperPath = "$env:TEMP\pc.jpg"
# Set registry with quotes for paths with spaces
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name Wallpaper -Value "`"$wallpaperPath`""
Add-Type @'
using System.Runtime.InteropServices;
public class NativeMethods {
[DllImport("user32.dll", SetLastError = true)]
public static extern bool SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
}
'@
[NativeMethods]::SystemParametersInfo(20, 0, $wallpaperPath, 3)
"`n$((Get-Date).ToString()) Wallpaper set to $wallpaperPath" | Out-File -FilePath "$env:USERPROFILE\wallpaperlog.txt" -Append
Start-Sleep -Seconds 10
# Copy to temp to ensure no spaces or access issues
Copy-Item "$env:USERPROFILE\Documents\Klantentools\pc.jpg" "$env:TEMP\pc.jpg" -Force
$wallpaperPath = "$env:TEMP\pc.jpg"
# Set registry with quotes for paths with spaces
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name Wallpaper -Value "`"$wallpaperPath`""
Add-Type @'
using System.Runtime.InteropServices;
public class NativeMethods {
[DllImport("user32.dll", SetLastError = true)]
public static extern bool SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
}
'@
[NativeMethods]::SystemParametersInfo(20, 0, $wallpaperPath, 3)
"`n$((Get-Date).ToString()) Wallpaper set to $wallpaperPath" | Out-File -FilePath "$env:USERPROFILE\wallpaperlog.txt" -Append
Last edited:
