Copying Users
Copying Users
Creates a copy of the specified User 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 User "Adam Sam" from the context "solys.local\Chicago\ITService\Users" using the method Copy().The copy is created in the same directory and it is named "Copy of Adam Sam":
Cd "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Users" $MyUser = Get-EmdbUser "Adam Sam" $MyUser.Copy() |
Create a copy of the User "Adam Sam" from the context "solys.local\Chicago\ITService\Users" 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\Users" $MyUser = Get-EmdbUser "Adam Sam" $MyUser.CopyTo("Adam Sam II.") |
Create a copy of the User "Adam Sam" from the context "solys.local\Chicago\ITService\Users" 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\Users" $MyUser = Get-EmdbUser "Adam Sam" $MyDestinationContainer = Get-EmdbOrganizationalUnit "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITGlobal\Users" $MyUser.CopyTo($MyDestinationContainer, "Adam Sam Jun.") |
Create a copy of the User "Adam Sam" from the context "solys.local\Chicago\ITService\Users" using the cmdlet Copy-Item:
$MyUserName = "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Users\Adam Sam" $MyDestinationContainerName = "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITGlobal\Users" Copy-Item -Path $MyUserName -Destination $MyDestinationContainerName |