Required in $Profile:
connect-qadservice -service "SERVER.DOMAIN"
What does it do:
This .PS1 file automates the disabling of a AD user account.
Utilize compare-object to verify said user is the logged on user to prevent unintended modification of AD object.
Creates a log on localhost. Path can be modified as needed for intended domain.
Modifies AD description field: "Account disabled by $UserName on $date".
Sends custom email with result of script to a specified email address.
Necessary script modifications required to make it run:
# At [$to = "."] replace with smtp mail recipient
# At [-SmtpServer "."] replace with SMTP Server
Suggested script modification for more specific use:
# At [start-transcript] consider specifying a path
# At [$body...] consider selecting any get-qaduser property
For more help try these cmdlet: