Concept Flow - New-ADUser and Set-ADUser
Start
Run New-ADUser
User Created in AD
Run Set-ADUser
User Properties Updated
End
First, a new user is created with New-ADUser. Then, Set-ADUser updates properties of that user.
New-ADUser -Name "John Doe" -SamAccountName "jdoe" -AccountPassword (ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force) -Enabled $true Set-ADUser -Identity "jdoe" -Title "Developer"
| Step | Command | Action | Result | Output |
|---|---|---|---|---|
| 1 | New-ADUser -Name "John Doe" -SamAccountName "jdoe" -AccountPassword ... -Enabled $true | Create user object | User 'jdoe' created in AD | No output if successful |
| 2 | Set-ADUser -Identity "jdoe" -Title "Developer" | Update user property | User 'jdoe' title set to 'Developer' | No output if successful |
| 3 | Verify user | Get user info | User 'jdoe' has Title 'Developer' | Name: John Doe SamAccountName: jdoe Title: Developer |
| 4 | End | No more commands | Process complete | Process finished successfully |
| Variable | Start | After Step 1 | After Step 2 | Final |
|---|---|---|---|---|
| UserObject | null | {Name: John Doe, SamAccountName: jdoe, Enabled: True} | {Name: John Doe, SamAccountName: jdoe, Enabled: True, Title: Developer} | {Name: John Doe, SamAccountName: jdoe, Enabled: True, Title: Developer} |
New-ADUser creates a new Active Directory user. Set-ADUser updates properties of an existing user. New-ADUser needs password and enabled status. Set-ADUser requires the user identity. Use Get-ADUser to verify changes. No output shown if commands succeed by default.