Retrieving any DSM Objects
Retrieving any DSM Objects
There are often situations, especially when working interactively in the shell, where you want to retrieve a particular DSM object for further investigation, to read or to set property values or to execute actions on it. In most situations the object type and the properties and methods available are known.
Starting with version 4.0 of the any DSM object can be retrieved by using the new cmdlet Cmdlet Get-EmdbItem and is automatically stored in an object of the appropriate type. This not only saves a lot of keyboard taps and eases the handling of any object, but can come in very handy, if you for example just know the Object-ID from a logfile or something similar and now want to investigate the object without knowing the concrete object-type upfront.
Examples:
Hint: The execution of these examples requires a connected PowerShell drive. |
The following example retrieves a DSM object with Object-ID 24567 without the need of knowing the actual object-type:
Get-EmdbItem -ItemID 24567 |
Note: The retrieval of objects by using the Object-ID can be carried out without supplying a path or that the object has to be in current working directory. Nevertheless you have to specify the drive to use or the working directory must be on the corresponding drive. Further please note, that the range of IDs is not inevitably unique for all DSM objects. Unless stated otherwise, PSX will search for objects that are retrieved using this method, under RootDSE (which can be compared to the ODS tree in the DSM console). |
If you, for example, want to retrieve a Catalog-Object, you should supply the GroupType-parameter:
Get-EmdbItem -ItemID 24567 -GroupType Catalog |
As an alternative, you can - as with many other Get-cmdlets - retrieve objects by supplying their full qualified path and name. For example you can get a Computer-object via the following command:
Get-EmdbItem "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\Production\Workstations\WIN10-01" |