I found this vbscript that does something similar to what i want to do in powershell. I want to be able to refresh the current user profile to see the change without logging out and back in. So is there a way to write this script in powershell
Set oShell = CreateObject("WScript.Shell")
Set oSHApp = CreateObject("Shell.Application")
Set oFSO = CreateObject("Scripting.FileSystemObject")
'Set Wallpaper to Path Below
sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = "C:\WINDOWS\DOMXP.bmp"
' Update Wallpaper in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
wscript.sleep 3000
'Refresh Screen
oSHApp.ControlPanelItem cstr("desk.cpl")
' alt. oShell.Run "control desk.cpl"
Do Until oShell.AppActivate ("Display Properties")
Loop
oShell.SendKeys "{DOWN}{UP}{TAB 3}~"
'Minimise all Windows.
oSHApp.MinimizeAll