→ The Lansweeper Customer Excellence Awards 2024 - Submit Your Project Now! Learn More & Enter Here
‎08-20-2019 12:58 PM
‎08-23-2019 05:07 PM
#DeployByLocation.ps1
#Splits the computername variable in to a location and PC number using a . delimiter.
$SplitVariable = $env:computername.IndexOf(".")
$DeviceLocation = $env:computername.Substring(0, $SplitVariable)
$PCNumber = $env:computername.Substring($SplitVariable+1)
#Sets different install files based upon location.
#Must create variables for each install file.
$DE123456 = "C:\InstallFileForLocation1\File.exe"
$DE098765 = "C:\InstallFileForLocation2\File.exe"
#Checks against a list of locations. If the location exists, it runs the file specified in the variables above and exists. If it doesn't exist, the script just exits.
#Must add switch for each location so that it knows what to run.
Switch ($DeviceLocation) {
"DE123456" { & $DE123456; break }
"DE098765" { & $DE098765; break }
default { exit; break }
}
‎08-22-2019 06:36 AM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now