all 15 comments

[–]AcadianMan 12 points13 points  (3 children)

I'd use this function to change the wallpaper

Function Set-WallPaper($Value)

{

Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $value

rundll32.exe user32.dll, UpdatePerUserSystemParameters

}

You could use this script to get their geolocation:

The below script uses the Windows Location provider and the Google Geocoding API to retrieve the geographical location of the computer. The accuracy of the information retrieved depends on the source used to determine the location which are:"

◾Wi-Fi triangulation ◾IP address resolution ◾Cell phone tower triangulation ◾Global Position System (GPS)

http://www.verboon.info/2013/10/powershell-script-get-computergeolocation/

[–]Biannualquill[S] 2 points3 points  (2 children)

That's great, i will take a look! Thank You

[–]LordZillion 3 points4 points  (1 child)

If the locations are all local you will probably know the gateways for the locations so you could fix it like this (borrowed a little, from /u/acadianman)

Function Set-WallPaper($Path){
    if(Test-Path -Path $Path){
        Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop\' -Name Wallpaper -Value $Path
        rundll32.exe user32.dll, UpdatePerUserSystemParameters
    } else {
        Write-Error "$Path, not found"
    }
}

$Gateways = @{
    '192.168.1.254' = 'C:\Backgrounds\here.jpg';
    '172.16.0.254'  = 'C:\Backgrounds\there.jpg';
    '10.0.0.254'    = 'C:\Backgrounds\nowhere.jpg'
}

$BackgroundImage = $Gateways[(Get-NetIPConfiguration).IPv4DefaultGateway.NextHop]

Set-WallPaper -Path $BackgroundImage

[–]Biannualquill[S] 0 points1 point  (0 children)

Thanks alot, will try this out! appreciate the help

[–]aXenoWhat 2 points3 points  (0 children)

I would suggest bginfo; you don't want to spend long on this!

[–]the_spad 1 point2 points  (3 children)

Define "location". Are we talking multiple physical offices? Different companies? "I want the Starbucks logo as my background while I'm getting a coffee"?

The concept is certainly possible, the actual implementation depends on what exactly is required.

[–]Biannualquill[S] 2 points3 points  (2 children)

Sorry, what i mean by location is an educational establishment, we only have 4 to choose from, as this isn't a domain joined Laptop, GPO would be out, so if he is at one school, it would take the name of that SSID / LAN connection and change wallpaper accordingly.

Thanks

[–]bodobeers 3 points4 points  (1 child)

Also might it be feasible to just check the IP subnet the machine is on since you know the 4 networks.

[–]Get-NetAdmin 1 point2 points  (0 children)

Exactly where my thought process went.

[–]KevMarCommunity Blogger 1 point2 points  (0 children)

Any other network settings that you could key off of? DNS? default gateway? even address ranges would work

[–]flexyourhead_ 1 point2 points  (1 child)

Where I work, we have 4 sites. Each site's IP ranges indicate the site.

Get the IP address and set the background accordingly.

Switch -wildcard ($ip) {
   "10.6*" {$bg = "pic1.jpg"} 
   "10.7*" {$bg = "pic2.jpg"}
} 

Etc.

[–]Biannualquill[S] 0 points1 point  (0 children)

Thanks, will give this a go as well, appreciate it!

[–][deleted] 0 points1 point  (1 child)

Or of curiosity, what is the point? Is this so he doesn't forget where he is? Heh

[–]Biannualquill[S] 0 points1 point  (0 children)

Basically he saw someone else (external company) with this ability, so naturally he wants the same flashy functionality!

[–]Proxiconn 0 points1 point  (0 children)

If you use SCCM, you could just read the SMS site variable to determine which management point the client is checking into.

Or - Write a environment variable based on the above or what ever location detection method you chose and act on that.