PowerShell script in AD for RESTING PASSWORD

Hey Guys,

I need help writing a PowerShell script in AD for Removing a User (disable user account\termination.

Where do I start and how? I have 0 PowerShell experience

Here is the steps

Reset password users in Active Directory
Remove all Profile tab option
remove all Profile tab options
remove all organization changes tab (and clear manager name) (SharePoint list)
remove Member Of groups except Domain Users
Remove user from Moble Device In Exchange
Babylon DJ Sounds -SteveAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BT15Commented:
You will need RSAT (Remote Server Administration Tools) installed

For starters, import the Active Directory Module into powershell
import-module Active Directory

Open in new window


To change the users password (https://docs.microsoft.com/en-us/powershell/module/addsadministration/set-adaccountpassword?view=win10-ps)

Set-ADAccountPassword -Identity USERNAME -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "PASSWORDHERE" -Force)

Open in new window

To zero out the fields:
#this command populates the a variable with all of the properties for the user account
$user = get-aduser -properties *

Open in new window


to see them all, just call the variable by itself

$user

Open in new window


To change them:

$user.ProfilePath = ''
$user.ScriptPath = ''
$user.HomeDirectory = ''
$user.HomeDirectory = ''
$user.HomedirRequired = $false

Open in new window

Do this to as many of the fields as you want to

once you are finished updating fields in your variable, publish them:

set-aduser -instance $user

Open in new window


to remove all of the users groups:

Get-ADPrincipalGroupMembership USERNAME | ? {$_.name -ne "Domain Users"} | % { Remove-ADGroupMember
$_.name -Members USERNAME}

Open in new window


I no longer have an Exchange Server to test with, so I cannot confirm this, but to remove the user's Mobile devices, the code could look something like this:

Get-ActiveSyncDevice -Identity USERNAME | Remove-ActiveSyncDevice

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Babylon DJ Sounds -SteveAuthor Commented:
Thank you. Will try it out and see
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.