Notification

Icon
Error

Deployment condition

Posted: Tuesday, August 20, 2019 11:58:51 AM(UTC)
Florian

Florian

Member Original PosterPosts: 1
0
Like
Hi,

I'm trying to create a deployment package which needs to check in which location the PC is at as each location has a slightly adjusted installer for that software.

e.g. there are multiple Locations whith the same pc Name pattern like DE123456.00001 the first part represents the location the last one is the PC number in that location.

I've tried to create a condition like...

ConditionType: Registry
Key Name: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName
Value: ComputerName
Condition: Has Value
Value: DE123456

As there is no condition "contains" it seems I'm not able to search for a part of the value.

Anyone has an idea how to get around this?

Many thanks,
Florian
CyberCitizen
#1CyberCitizen Member Posts: 210  
posted: 8/22/2019 5:36:05 AM(UTC)
I am guessing that you would have to call a script and that script checks the conditions of the HOSTNAME etc and then calls the necessary install commands based on that. The conditions of Lansweeper isn't really designed for that.

If you have your AD Environment setup with different office locations (OU's) etc, you could create a report based on that data and then deploy via the report.
RKCar
#2RKCar Member Posts: 29  
posted: 8/23/2019 4:07:30 PM(UTC)
Building off of what CyberCitizen said, this piece of PowerShell splits your computer names in to two pieces using the "." character as the delineation. I did it like this as I wasn't sure if your locations would have different lengths or not. You have to define your location names and what file to deploy for the specific location. I'm sure this could be improved upon as I'm a novice with PS.

Oh also the $PCNumber variable isn't actually used, but I figured in case you wanted to use it for something you would have it available.

Code:
#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 }
    }

Active Discussions

Lansweeper Remove all users from old domain
by  cmuter   Go to last post Go to first unread
Last post: 9/20/2019 8:03:58 PM(UTC)
Lansweeper Static IP Address
by  cycleheat  
Go to last post Go to first unread
Last post: 9/20/2019 4:07:16 PM(UTC)
Lansweeper Bitlocker Encryption Recovery Key no information found
by  Stephane   Go to last post Go to first unread
Last post: 9/20/2019 2:26:19 PM(UTC)
Lansweeper InTune Scanning Issues
by  Esben.D  
Go to last post Go to first unread
Last post: 9/20/2019 12:34:59 PM(UTC)
Lansweeper Office 365 scanning issues
by  Esben.D   Go to last post Go to first unread
Last post: 9/20/2019 12:23:30 PM(UTC)
Lansweeper Hard Drive Tracking - Start to Finish
by  Lone Jedi  
Go to last post Go to first unread
Last post: 9/19/2019 8:11:56 PM(UTC)
Lansweeper Lansweeper Reporting Old Assets as New
by  Jpatterson   Go to last post Go to first unread
Last post: 9/19/2019 12:52:14 PM(UTC)
Lansweeper Cannot edit a ticket anymore
by  Esben.D  
Go to last post Go to first unread
Last post: 9/19/2019 12:32:42 PM(UTC)