PSIGEL – Get-UMSDeviceDirectory

This function gets device directories from the UMS.

At default you get an object containing all device directories. If you use the parameter Filter -children you get the direct children (endpoints, directories) as well.

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
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 all device directories


The output for one directory would be:

Id         : 13357
Name       : Room305
ParentId   : 13091
MovedToBin : False
ObjectType : tcdirectory

Scenario 2 – show me the device directory with the ID 198 and its children

Get-UMSDeviceDirectory -Id 198 -Filter children

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

Id                : 198
Name              : Computers01
ParentId          : 197
MovedToBin        : False
ObjectType        : tcdirectory
DirectoryChildren : {@{ObjectType=tcdirectory; Id=199}, @{ObjectType=tcdirectory; Id=200}, @{ObjectType=tcdirectory; Id=201}, @{ObjectType=tcdirectory; Id=202}...}

Scenario 3 – Show me only the direct children of the directory with the ID 198:

(Get-UMSDeviceDirectory -Id 198 -Filter children).DirectoryChildren

The output would be similar to this:

ObjectType   Id
----------   --
tcdirectory  199
tcdirectory  200
tcdirectory  201
tcdirectory  202
tc          4213

Scenario 4 – Show me all endpoints in the device directories which names contain “Test”

If you need to know all endpoints in directories with a similar naming convention, this can be a solution:

(((Get-UMSDeviceDirectory).where{ $_.name -match "Test" } |
  Get-UMSDeviceDirectory -Filter children).DirectoryChildren).where{$_.ObjectType -eq 'tc'}


ObjectType    Id
----------    --
tc          7167
tc          4320
tc          4310

If you need to get all directories and/or endpoints below a given device directory, than the next part of this series got you covered.

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

Comment here