Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need some help!! #2

Open
IAMinZoho opened this issue Aug 16, 2022 · 1 comment
Open

Need some help!! #2

IAMinZoho opened this issue Aug 16, 2022 · 1 comment

Comments

@IAMinZoho
Copy link

First of all, applauds for the excellent work!

I want the set a wallpaper and using raw github url to fetch the wallpaper. Currently I am using this but it does work with Windows 10, but fails to set wallpaper on Windows Server 2008 R2. Any suggestions are welcome.

function RemoveWallpaper {
$code = @'
using System.Runtime.InteropServices;
namespace Win32{

 public class Wallpaper{ 
    [DllImport("user32.dll", CharSet=CharSet.Auto)] 
     static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ; 
     
     public static void SetWallpaper(string thePath){ 
        SystemParametersInfo(20,0,thePath,3); 
     }
}

}
'@

Invoke-WebRequest -useb https://raw.githubusercontent.com/.....x.png -Outfile $env:temp\PSWall.jpg
$MyWallpaper="$env:temp\PSWall.jpg"
add-type $code
[Win32.Wallpaper]::SetWallpaper($MyWallpaper)
}

@IAMinZoho IAMinZoho changed the title Need some help Need some help!! Aug 16, 2022
@IAMinZoho
Copy link
Author

Hello Sir,
Instead of setting a bold Red wallpaper, I wanted to set a wallpaper from a raw GitHub page. How can I achieve this? I did try the code ( posted in the previous message) but it fails to work on 2008 R2. Any suggestions are most welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant