How to get the parent ID for the main folder in IGEL OS?


Hello – I am trying to figure out what’s the parent ID for the main folder I need to get the PARENT ID from the PARENT Root folder, for example ROOT FOLDER “MY COMPANY” then I have sub folders TC US and sub folder TC EU. I would like to know what’s the Parent ID for the MY COMPANY root folder (the one provided by the UMS console when I checked by placing the cursor on top of it is not correct). I’ve used this PS to get the Parent ID but it does not return the root folder just the sub folders. Get-UMSDevice | Select Name, ParentId, Id, LastIp | Out-GridView – Any thoughts? Thanks!

Learn more, read the entire thread inside the IGEL Community o Slack

You mean the main Endpoint folder now called Devices (former Thinclients, I believe)?

Should be -1 but let‘s see if someone corrects me. What is the purpose IMI Script?


Something like this… the main folder is call MMC then I have sub folders and they TC’s belong to the sub folder. I am trying to figure out the ID of the MMC main folder to use with a PSIGEL script.


Usually, just move the mouse cursor on it, hold on a few secs and it should be shown beween ()


the ID of the root folder, named “Devices” or earlier “Thinclient” is -1.

You can search for the ParentId of a folder by looking for its name (or Id, if you have folders with similar names):

((Get-UMSDeviceDirectory -ComputerName ‘igelrmserver’ -WebSession $WebSession).Where{$_.Name -eq ‘FOLDERNAME’}).ParentId

> am trying to figure out the ID of the MMC main folder

((Get-UMSDeviceDirectory -ComputerName ‘igelrmserver’ -WebSession $WebSession).Where{$_.Name -eq ‘MMC’}).Id


Yep, so when I run the following with the parent folder ID

$parentIDs = 89307

$results = Get-UMSDevice |

Where-Object {$parentIDs -contains $_.ParentId} |

Get-UMSDevice -Filter Details |

Select-Object -Property *, @{n=’Online’; e={(Get-UMSDevice -Filter Online -Id $_.Id).Online}} |

Where-Object {($_.Comment -ne ‘excluded’)} |

Select-Object -ExpandProperty Name

$results

it does NOT return anything, however when I use the ID of a sub folder works as expected and returns the TC’s.


ähm yeah you are :

> $results = Get-UMSDevice |

making a request for all devices

then:

> Get-UMSDevice

foreach device a request for all devices (its ok since the API-bug is in place, but slow)

and then

> Select-Object -Property *, @{n=’Online’; e={(Get-UMSDevice -Filter Online -Id $_.Id).Online}} |

foreach device again a request for all devices – this is … just dont do it 😄


So from your perspective what will be the code to manage that output using the parent root ID folder and include all the TC’s that belong to it (sub folders included).


for the devices in one folder:

$ParentID = 71

$DeviceDetailColl = Get-UMSDevice -Filter details

$DeviceOnlineColl = $DeviceDetailColl |

Where-Object {$_.ParentID -eq $ParentId} |

Get-UMSDevice -Filter online |

Where-Object {$_.online -eq $true}

$DeviceCollParams = @{

Left = $DeviceOnlineColl

LeftJoinProperty = ‘Id’

Right = $DeviceDetailColl

RightJoinProperty = ‘Id’

RightProperties = ‘Comment’

Type = ‘AllInLeft’

}

$DeviceColl = Join-Object @DeviceCollParams

$DeviceColl

this is using the Join-Object function i sent the link to you some time ago

this gives you an object like this:

Id : 195

ObjectType : tc

UnitId : 00515734C234

Mac : 00515734C234

Name : V11-01

ParentId : 71

FirmwareId : 2

LastIp : 192.168.56.101

MovedToBin : False

Online : True

Comment : [SingleLicensed]

if you need all the devices under a folder including subfolders, you have to get them in the first place.

I have done something similar here: github.com/IGEL-Community/PSIGEL/blob/master/Scripts/GetUMSDirectoryStructure.ps1

but only for the directories and for a static number of folder levels

if you know the folders themselves, and they are not too many, than you can use:

$ParentIDColl = @(71, 457, 458)

$DeviceDetailColl = Get-UMSDevice -Filter details

$DeviceOnlineColl = $DeviceDetailColl |

Where-Object {$ParentIDColl -contains $_.ParentId} |

Get-UMSDevice -Filter online |

Where-Object {$_.online -eq $true}

….


yeah, I was doing it by sub folder’s ID’s and that works but I was trying to avoid missing the new ones later on when they are introduced into the system.


atm i have not a really clean solution for this, but maybe i caome up with one sometime


Thanks Falk!

Continue reading and comment on the thread ‘How to get the parent ID for the main folder in IGEL OS?’.  Not a member? Join Here!

Learn more, search the IGEL Knowledge Base



Ask a question or comment on the above message thread?

Join or log in to the IGEL Community to ask us anything and meet other IGEL customers, partners, and EUC enthusiasts.

Submit a question, or Join Today!


Popular Message Threads


Categories & Tags: