IGELPSIGEL

PSIGEL – Get-UMSDevice

This function gets devices from the UMS. The API makes 4 distinctions here:

  • short
  • details
  • online
  • shadow

Those are implemented in Get-UMSDevice with the Filter parameter, short being the default value.

At default you get an object containing all devices. If you use the parameter ID you can specify the ID of the device
you are looking for.

For the following scenarios it is assumed you already created a WebSession and bound it to $WebSession.

The online documentation on this function can be found here.

The properties which are shown in the following scenarios can be read on here.

Scenarios – preparations

The examples in the scenarios to come require several parameters as Computername and WebSession to be provided for each
function.
To prevent redundancy in providing those basic parameters $PSDefaultParameters are used:

$PSDefaultParameterValues = @{
  '*-UMS:Computername' = 'igelrmserver'
  'New-UMSAPICookie:Credential' = (Get-Credential)
}
$PSDefaultParameterValues += @{
  '*-UMS:WebSession' = New-UMSAPICookie
}

This code block at the beginning of a script sets Computername and WebSession for all functions to be used and is
implied to be used in the following scenarios.

Scenario 1 – show me short infos on all devices

Get-UMSDevices

Per default the Filter Parameter short is used here and the output for one device would be:

Id         : 24
ObjectType : tc
UnitId     : 00E0C513A34D
Mac        : 00E0C513A34D
Name       : DEV12345
ParentId   : 75
FirmwareId : 8
LastIp     : 192.168.1.1
MovedToBin : False

Scenario 2 – show me detailed infos on the device with ID 24

Get-UMSDevices -ID 24 -Filter details

The Filter Parameter details is used here and the output would be:

Id                        : 24
ObjectType                : tc
UnitId                    : 00E0C513A34D
Mac                       : 00E0C513A34D
Name                      : DEV12345
ParentId                  : 75
FirmwareId                : 8
LastIp                    : 192.168.1.1
MovedToBin                : False
NetworkName               : DEV12345
Comment                   :
ProductId                 : UD3-LX 50ac
CpuSpeed                  : 1200
CpuType                   : AMD GX-412HC SOC with Radeon(TM) R3E Graphics
DeviceType                : IGEL M340C
DeviceSerialNumber        : 14D3E3C02B161503D1M
OsType                    : IGEL Linux V5 (Kernel Version 4.4.83)
FlashSize                 : 1917
MemorySize                : 1717
NetworkSpeed              : 0
GraphicsChipset0          : ATI MULLINS
GraphicsChipset1          :
MonitorVendor1            : BNQ
MonitorModel1             : BenQ G900
MonitorSerialnumber1      : N7805182SL0
MonitorSize1              : 19
MonitorNativeResolution1  : 1280 x 1024
Monitor1YearOfManufacture : 2008
Monitor1WeekOfManufacture : 29
MonitorVendor2            :
MonitorModel2             :
MonitorSerialnumber2      :
MonitorSize2              : 0
MonitorNativeResolution2  :
Monitor2YearOfManufacture : 0
Monitor2WeekOfManufacture : 0
BiosVendor                : Insyde Corp.
BiosVersion               : M340C V:3.3.13-12162015
TotalUsagetime            : 5914350000
TotalUptime               : 31000
BatteryLevel              : -1
LastBootTime              : 26.03.2019 07:49:00
BiosDate                  : 16.12.2015 00:00:00

Scenario 3 – show me “online” infos on the devices with ID 24 and 25

24, 25 | Get-UMSDevices -Filter online

The IDs are piped into the function, the Filter Parameter online is used here and the output would be (showing DEV23456
is online):

Id : 24
ObjectType : tc
UnitId     : 00E0C513A34D
Mac        : 00E0C513A34D
Name       : DEV12345
ParentId   : 75
FirmwareId : 8
LastIp     : 192.168.1.1
MovedToBin : False
Online     : False

Id         : 25
ObjectType : tc
UnitId     : 00E0C512AEFE
Mac        : 00E0C512AEFE
Name       : DEV23456
ParentId   : 76
FirmwareId : 8
LastIp     : 192.168.2.1
MovedToBin : False
Online     : True

Scenario 4 – show me “shadow” infos on the device with ID 24

Get-UMSDevices -ID 24 -Filter shadow

The Filter Parameter detailed is used here and the output would be:

Id           : 24
ObjectType   : tc
UnitId       : 00E0C513A34D
Mac          : 00E0C513A34D
Name         : DEV12345
ParentId     : 75
FirmwareId   : 8
LastIp       : 192.168.1.1
MovedToBin   : False
ShadowSecret : @{certificate=-----BEGIN CERTIFICATE-----
MITE1jCCAr6gAwIBAgIESmwpyDANBgkqhkiG9w0BAQ0FADAtMQswCQYDVQQGEwJE
RTEPMA0GA1UEBxMGQnJlbWVuMQ0wCwYDVQQKEwRJR0VMMB4XDTEzMTIzMTIzMDAw
MVoXDTM2MTIzMTIzMDAwMVowLTELMAkGA1UEBhMCREUxDzANBgNVBAcTBkJyZW1l
bjENMAsGA1UEChM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B1xhnA/hS40VqmbIyTWkZhu+g7IEPzrS85dhPBz9HwVIspeoQKX77Ds3/J65Su+n
WBXLrWABZUZR1OVS7EidNsTqQvixws53dIT361KMdeIY534BAGeLjJQLA9Bff+jF
ScQIBnrYVJqSvN4N6TW7gi5bj5IRztH5QmN2Zw/hoXgo4WRXU450BfiU79K3pycY
2bx/BO8UfJgb1gHXYSFdgdTBYn0CdSmV/rMmnEHg72WAMKJI32QRYLqQYAE8KrW1
M5WiENfrUmeYTCbK+au52cr9h+F3FZB3LfyqDWAGtL2CTavYf/pd/ro4yHzjK4fW
lUpb7tRvPdLf+7Z4DB4qvYPxwmMwKDsgzYdY+GjOeaRjHxlkWJ0fOhJI
-----END CERTIFICATE-----
; password=dd82d3f7-de84-410a-a8e1-bfbe82348dff}

Scenario 5 – give me the name of all devices which are in the directory with the ID 76

$Result = Get-UMSDevice | Where-Object -Property ParentId -eq 76 |
  Select-Object -Property Name
$Result

Output:

Name
----
DEV04156
DEV04157
DEV04159
DEV04160
DEV04163
DEV05000
DEV05004
DEV05007
DEV05010
DEV05016
DEV05020

Scenario 6 – give me the last IP of all online devices which do not have the Comment “Test-Device”

Here we want to have a collection of IP addresses of all devices that are online to take an action on, but do not want
to include test-devices:

$Result = Get-UMSDevice -Filter online | Get-UMSDevice -Filter details |
  Where-Object -Property Comment -ne 'Test-Device' | Select-Object -Property LastIP
$Result

Output:

LastIp
------
192.168.2.110
192.168.1.115
192.168.2.109
192.168.2.105
192.168.2.6
192.168.2.3
192.168.1.100
192.168.1.12
192.168.2.8

Scenario 7 – create a report of all devices with FirmwareId 8 as a csv file, ready for Excel

Get-UMSDevice | Where-Object -Property FirmwareId -eq 8 |
  Export-Csv -Path C:\Temp\Report.csv -NoTypeInformation -Encoding Default -Delimiter ";"

Output:

"Id";"ObjectType";"UnitId";"Mac";"Name";"ParentId";"FirmwareId";"LastIp";"MovedToBin"
"2433";"tc";"00E0C633CB36";"00E0C633CB36";"DEV34156";"76023";"8";"192.168.2.110";"False"
"2435";"tc";"00E0C633CEDE";"00E0C633CEDE";"DEV34157";"76023";"8";"192.168.2.108";"False"
"2437";"tc";"00E0C633D5DA";"00E0C633D5DA";"DEV34158";"51";"8";"192.168.1.115";"False"
"2439";"tc";"00E0C633D602";"00E0C633D602";"DEV34159";"76023";"8";"192.168.2.109";"False"
"2441";"tc";"00E0C633D604";"00E0C633D604";"DEV34160";"76023";"8";"192.168.2.105";"False"
"2443";"tc";"00E0C633D78C";"00E0C633D78C";"DEV34163";"76023";"8";"192.168.2.6";"False"
"2445";"tc";"00E0C6349777";"00E0C6349777";"DEV35000";"76023";"8";"192.168.2.3";"False"
"2447";"tc";"00E0C6349786";"00E0C6349786";"DEV35001";"51";"8";"192.168.1.100";"False"
"2449";"tc";"00E0C634978A";"00E0C634978A";"DEV35002";"51";"8";"192.168.1.12";"False"
"2451";"tc";"00E0C6349791";"00E0C6349791";"DEV35004";"76023";"8";"192.168.2.8";"False"

Scenario 8 – create an Excel report of all devices with FirmwareId 8

If you want to go a step further than Scenario 7 and make a really nice Excel Report you can use the ImportExcel module which does not need Excel to be installed. This module has plenty of options worth to explore.

Get-UMSDevice | Select-Object -First 10 | Where-Object -Property FirmwareId -eq 8 |
  Export-Excel -Path C:\Temp\Report.xlsx -AutoSize -FreezeTopRow -FreezeFirstColumn -NoNumberConversion LastIP -BoldTopRow

Output:

In the next part of the series we will take a look at the Get-UMSDeviceDirectory function.

Comment here