combining a Get-ADUser & Set-ADUser

I’m working on automating setting up a new user. I’ve already created a generic template that has office and location info filled out. Now I’m working on setting the title, department, and manager. I’d like to use an existing employee who already has the data filled out on the account that is new and not created.

So I’m able to copy over the Memberof properties through this Powershell script.

import-module ActiveDirectory $usersName = Read-Host -Prompt ‘Input the AD Credentials of the account that needs properties’ $copyUserName = Read-Host -Prompt ‘Input the AD Credentials of the account that we will copy properties from.’

Get-ADUser -Identity $copyUserName -Properties memberof | Select-Object -ExpandProperty memberof | Add-ADGroupMember -Members $usersName

Howerver i’m at a loss on how to get other properties to copy of. I’ve started a Get-ADUser command: $user = Get-ADUser -Identity $copyUserName -Properties Description, Title, Department, Manager

but I can’t seem to figure out how to incorporate it into a Set-ADUser.

Any assistance is appreciated.

submitted by /u/Talgonadia
[link] [comments]

Leave a Reply