Advertisement
metalx1000

Set Desktop Background Wallpaper

Jun 5th, 2015
700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <#
  2. Check Deskop Wallpaper
  3. PowerShell -ExecutionPolicy Bypass .\wallpaper.ps1
  4. #>
  5.  
  6. $url="http://69.65.44.235/images/wallpapers/biggunpunisher-9625.jpeg"
  7. $file = "paper.jpg"
  8.  
  9. function Set-WallPaper(){
  10.  Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $file
  11.  rundll32.exe user32.dll, UpdatePerUserSystemParameters
  12.  
  13.  #Remove-Item $file
  14. }
  15.  
  16. function Get-WallPaper(){
  17.     Write-Output "Downloading Wallpaper to $file..."
  18.  
  19.     $webclient = New-Object System.Net.WebClient
  20.     $webclient.DownloadFile($url,$file)
  21.     Write-Output "File Downloaded"
  22.    
  23.     Set-WallPaper
  24. }
  25.  
  26.  
  27. Get-WallPaper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement