Copying Computers

Creates a copy of a Computer object and assigns a new name to the copy.


Examples:


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


Create a copy of the Computer named "XP01" from the context "solys.local\Chicago\ITService\Workstations" using the method Copy(). The copy is created in the same directory and it is named "Copy of XP01":


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

$MyComputer = Get-EmdbComputer "XP01"

$MyComputer.Copy()


Create a copy of the Computer named "XP01" from the context "solys.local\Chicago\ITService\Workstations" using the method CopyTo(). The copy is created in the same directory and the name of the copy is specified as a parameter:


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

$MyComputer = Get-EmdbComputer "XP01"

$MyComputer.CopyTo("Copy of XP01")


Create a copy of the Computer named "XP01" from the context "solys.local\Chicago\ITService\Workstations" using the method CopyTo(). The target directory as well as the name of the copy is specified as a parameter:


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

$MyComputer = Get-EmdbComputer "XP01"

$MyDestinationContainer = Get-EmdbOrganizationalUnit "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITGlobal\Workstations"

$MyComputer.CopyTo($MyDestinationContainer, "Copy of XP01")


Create a copy of the Computer named "XP01" from the context "solys.local\Chicago\ITService\Workstations" using the cmdlet Copy-Item:


$MyComputerName = "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\XP01"

$MyDestinationContainerName = "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITGlobal\Workstations"

Copy-Item -Path $MyComputerName -Destination $MyDestinationContainerName