Creating Computers

Creates a Computer object in the current or in the specified context


Examples:


Hint: The execution of these examples requires a connected PowerShell drive.


Create a Computer named "XP21" in the context "solys.local\Chicago\ITService\Workstations":


New-EmdbComputer "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\XP21"


Create a Computer named "XP22" in the current context:


Cd "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations"

New-EmdbComputer "XP22"


Create a Computer named "XP23" in the context "Managed Users & Computers\solys.local\Chicago\ITService\Workstations" using the cmdlet New-Item:


New-Item -Path "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations" -Name "XP23" -ItemType "Computer"


Create a Computer named "XP24" in the current context using the cmdlet New-Item:


Cd "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations"

New-Item "XP24" -ItemType "Computer"


Hint: In the context of the emdb drive, the cmdlet New-Item provides the additional parameter -DelayCreation. Using this parameter creates the object on the client side only and doesn't propagate the changes to the DSMDB instantly. Now you can manipulate properties of this object and finally the changes can be propagated to the DSMDB by calling the method Create().


Example:


Cd "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations"

$MyNewComputer = New-Item "XP25" -ItemType "Computer" -DelayCreation

$MyNewComputer.ComputerType = "Laptop"

$MyNewComputer.OperationMode = "Active"

$MyNewComputer.Create()