Difference between revisions of "Active Directory (PowerShell)"

Jump to navigation Jump to search
m
m (→‎Users: Added "Remove-ADUser")
m (→‎Remove-ADUser examples: Added warning)
Line 109: Line 109:


=== <code>Remove-ADUser</code> examples ===
=== <code>Remove-ADUser</code> examples ===
It would normally be quite foolhardy to delete a user account that wasn't already disabled.  Deletion removes group memberships, file-permissions etc etc. Whilst you can create a new account with the same name, it won't have the same [[Acronyms#S|SID]] so '''it's not the same account'''.
<source lang="powershell">
<source lang="powershell">
Remove-ADUser -Identity $user -Confirm:$false                  # $user retrieved from Get-ADUser, -Confirm:$false prevents confirmation prompt
Remove-ADUser -Identity $user -Confirm:$false                  # $user retrieved from Get-ADUser, -Confirm:$false prevents confirmation prompt

Navigation menu