Say, you received an order of 50+ IGEL devices and your procurement department just finished creating assets and inventory numbers for each of them.
The next step would be to import them in your UMS – and since you requested an import file in a serial number format:
…
you can just do that with the existing function within the UMS:
By default, all imported devices are named the prefix “TC-” and the UnitID of the device (f.i. “TC-00E0C5235813”).
If you want to address your own naming convention you will not find help out of the box.
One way a lot of companies want to do, is to name their devices incorporating a prefix and asset information. Here your procurement department will be able to provide you a list, containing the serialnumber and said asset information, e.g. inventory number:
…
Given both datasets we are now able to to merge both datasets and use the API with my Powershell module PSIGEL to create new devices and use the naming convention DEV-InventoryNumber.
I start by setting default parameters for authorization and UMS-server:
$PSDefaultParameterValues = @{ '*-UMS*:Computername' = 'igelrmserver' 'New-UMSAPICookie:Credential' = (Get-Credential) } $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = New-UMSAPICookie }
Then I define the path to both the IGEL serialnumber format and the asset file and import them into objects:
$Path = 'C:\Temp\' $IGELImportFile = '{0}2260123456-000010.csv' -f $Path $AssetExportFile = '{0}Assets.csv' -f $Path $IGELImportColl = Import-Csv -Delimiter ';' -Path $IGELImportFile -Header '0', 'SerialNumber', 'MacAddress', '3', '4' $AssetExportColl = Import-Csv -Delimiter ';' -Path $AssetExportFile
I provide the prefix and the major version number for the new devices:
$DevicePrefix = 'DEV-' $MajorVersion = 10
Now I determine the ID of the latest firmware version for the aforementioned major version:
$FirmwareId = (((Get-UMSFirmware).where{ $_.Version.Major -eq $MajorVersion } | Sort-Object -Property Version -Descending)[0]).Id
In the next step I use the Join-Object function from Warren Frame to join both dataset objects I imported at the beginning:
$NewDeviceCollParams = @{ Left = $IGELImportColl LeftJoinProperty = 'SerialNumber' LeftProperties = 'SerialNumber', 'MacAddress' Right = $AssetExportColl RightJoinProperty = 'SerialNumber' RightProperties = 'InventoryNumber' Type = 'AllInLeft' } $NewDeviceColl = Join-Object @NewDeviceCollParams
In the last step I create a new device from each item of the resulting object:
foreach ($NewDevice in $NewDeviceColl) { $NewDeviceParams = @{ Mac = $NewDevice.MacAddress FirmwareId = $FirmwareId Name = '{0}{1}' -f $DevicePrefix, $NewDevice.InventoryNumber SerialNumber = $NewDevice.SerialNumber AssetId = $NewDevice.InventoryNumber } New-UMSDevice @NewDeviceParams }
Please note, I also add the inventory number as Asset ID, so that in case the device is renamed back to default IGEL naming convention TC+UnitID (happens sometimes) you can still assign the devices according to the asset information.
If all goes well, I get an output like that:
... Mac : 00E0C52375EB Message : Device successfully inserted. Name : DEV-2843 ParentId : -1 Mac : 00E0C52375EB Message : Device successfully inserted. Id : 1975 Name : DEV-2824 ParentId : -1 Mac : 00E0C52375EC Message : Device successfully inserted. Id : 1976 Name : DEV-2844 ParentId : -1 ...
New devices in the UMS:
Below the complete script:
$PSDefaultParameterValues = @{ '*-UMS*:Computername' = 'igelrmserver' 'New-UMSAPICookie:Credential' = (Get-Credential) } $PSDefaultParameterValues += @{ '*-UMS*:WebSession' = New-UMSAPICookie } $Path = 'C:\Temp\' $IGELImportFile = '{0}2260123456-000010.csv' -f $Path $AssetExportFile = '{0}Assets.csv' -f $Path $IGELImportColl = Import-Csv -Delimiter ';' -Path $IGELImportFile -Header '0', 'SerialNumber', 'MacAddress', '3', '4' $AssetExportColl = Import-Csv -Delimiter ';' -Path $AssetExportFile $DevicePrefix = 'DEV-' $MajorVersion = 10 $FirmwareId = (((Get-UMSFirmware).where{ $_.Version.Major -eq $MajorVersion } | Sort-Object -Property Version -Descending)[0]).Id $NewDeviceCollParams = @{ Left = $IGELImportColl LeftJoinProperty = 'SerialNumber' LeftProperties = 'SerialNumber', 'MacAddress' Right = $AssetExportColl RightJoinProperty = 'SerialNumber' RightProperties = 'InventoryNumber' Type = 'AllInLeft' } $NewDeviceColl = Join-Object @NewDeviceCollParams foreach ($NewDevice in $NewDeviceColl) { $NewDeviceParams = @{ Mac = $NewDevice.MacAddress FirmwareId = $FirmwareId Name = '{0}{1}' -f $DevicePrefix, $NewDevice.InventoryNumber SerialNumber = $NewDevice.SerialNumber AssetId = $NewDevice.InventoryNumber } New-UMSDevice @NewDeviceParams }
systems engineer, long time IGEL costumer, Powershell enthusiast, Leipzig/Germany
Thanks for sharing this. I am going to see if I can incorporate the steps outlined, but to setup the names from a predefined list matching client to host name. One thing I was thinking was if this can be incorporated into an on demand service. For example onsite tech, setup’s new client, then send an email with MAC address and name desired, then script handles the naming of client in UMS and on client.
maybe i am getting it wrong, but when the onsite tech sets up a new client, he can set a name for the device in the process as well.
In case you mean your onsite tech gets a bunch of devices and has a list (mac, name) for those devices, he could put this list in a fileshare. You could than automate a script (f.i. via jenkins) to read in the list, rename the clients and remove the list.
please let me know if this was not what you were going for.
Lots of good information. Falk, do you know of a way to change the Hostname/Terminal Name or as its listed in the console “Network Name (at Boot Time)” of a device via the API? We’ve been able to change the UMS Name but not the actual hostname of the device.
Yes, you can: https://github.com/IGEL-Community/PSIGEL/blob/master/Docs/Reference/Update-UMSDevice.md#example-1
But be aware of this setting: https://kb.igel.com/endpointmgmt-6.05/en/device-network-settings-31599965.html#DeviceNetworkSettings-AdjustNamesofDevices
thanks for the quick response! We must be missing something. that’s how are are changing the name and we have the setting set ” If the UMS-internal name of the device is changed, the network name of the device will be set to the new UMS-internal name.” but it doesn’t sync the network name to the UMS-internal name. even after we send the settings2tc command and reboot.
Hey Michael, why don’t you come over to igelcommunity.slack.com ? We (and a lot of other folks) can have a further discussion there!
Thanks for the suggestion. I’ve posted in the #igel-ums channel. Thanks again!