Retrieving Computers
Retrieving Computers
Retrieves the specified Computer object(s).
Examples:
Hint: The execution of these examples requires a connected PowerShell drive. |
Retrieve the Computer "XP01" from the Organizational Unit "Chicago\ITService\Workstations":
Get-EmdbComputer "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\XP01" |
Retrieve all Computers from the Organizational Unit "Chicago\ITService\Workstations":
Get-EmdbComputer "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\*" |
Retrieve all Computers having their names starting with the substring "XP" from "Chicago" and subordinated Organizational Units:
Get-EmdbComputer "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\XP*" -Recurse |
Retrieve the Computer "XP01" from the current context:
Cd "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations" Get-EmdbComputer "XP01" |
Retrieve the Computer "XP01" in the current context through its Item-ID (this ID will vary in different DSM environments):
Get-EmdbComputer -ItemID 12323 -Recurse |
Tip: the alias ID can be used instead of ItemID. |
Retrieve the Computer "XP01" from the current context using the cmdlet Get-Item:
Cd "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations" Get-Item "XP01" |
Retrieve all Computers having their names starting with the substring "XP" from "Chicago" and subordinated Organizational Units using the cmdlet Get-ChildItem:
Get-ChildItem "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago" -Filter "&(Name=XP*)(SchemaTag=Computer)" -Recurse |
Starting with PSX 3.1 there was a new option implemented when retrieving Computer objects. When specifying the SingleItemExpected-switch it is expected, that none or exactly one object is contained in the result. If the retrieval returns more than one object, an error is raised that can be caught and handled in scripts.