Changing service account password on multiple computers in the service filed

I am trying to change all the passwords on multiple 2008 r2 servers but I get errors and I am not good at this please help..

maybe something that reads a test file and then changes the Service password on each server and have a text input to revile success on each server or fail.

I am using PowerShell and here is my example.

icm $Servertest { /StartMode=Automatic /account=user /username=Server1 Service/password=XXXXXXXXXX}
Eric PerezAsked:
Who is Participating?
becraigConnect With a Mentor Commented:
So you can use the script above with a slight modification.

So instead we just simply search for the service by name then make the change :

$acctname = "domain\user"
$svcpwd  = "password"
#Text file
$servers = (gc serverlist.txt) 
#from AD 
#Import-Module ActiveDirectory
#$servers = (Get-ADComputer -Filter *)

foreach ($server in $servers) 
$servicename = "Name of the service to change"
write-host "updating $servicename"
$svcnm = gwmi win32_service -computername $server -filter "name='$servicename'"
#Update Service
#Stop Service
#Start Service

Open in new window

Will SzymkowskiSenior Solution ArchitectCommented:
Is this service account password a local account on the machines itself? Or do you have an AD account that has a password cached on a service that you are managing with it?

Eric PerezAuthor Commented:
Hi Will its a AD account used as a service account, not local...
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Here is a previously answered question where I wrote a short script to do this:
Eric PerezAuthor Commented:
Ok I miss spoke some, its using the default service account which I need to change all of the servers using a specific service to change the default to a specified service account name and change the password.
Eric PerezAuthor Commented:
where does this txt file get placed?
 $servers = (gc serverlist.txt)
You can change
gc serverlist.txt

gc c:\folder\filenamet.txt
Where the path is the exact path to the text file with your list of servers.
Eric PerezAuthor Commented:
great response to the problem.. and interaction...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.