Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Israel Torres
- # 2012-03-14
- # Kills AD User from AD [WARNING USER IS DELETED]
- Import-Module ActiveDirectory
- #
- # args: username, security group
- if($args.Length -eq 1){
- $username = $args[0]
- if (!(Get-ADUser -filter {SamAccountName -eq $username})) {
- Write-Host "User: $username does not exist; run .\CreateADUser.ps1 username password."
- }else{
- Write-Host "Killing User:$username!"
- Remove-ADUser -Identity $username -Confirm:$false
- }
- }else{
- Write-Host "Usage: .\killADUser.ps1 username"
- }
- #EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement