Tuesday, July 26, 2011

Home /Active Directory /Microsoft /PowerShell /script /Windows /Windows 2008 R2 /Windows Server 2008 R2 / Change Service Account Username & Password–PowerShell Script

Change Service Account Username & Password–PowerShell Script

This PowerShell script can be used to change the service account credentials remotely. 

Input – The input file (input.csv) contains server/computer name in the following format: 

image

Script

image

Output – You will see the status on the screen as shown in the following screenshot:

image

Download – You can download this script from the following locations:

  1. www.sivarajan.com - http://www.sivarajan.com/scripts/Change_Service_Credentials.txt
  2. Microsoft TechNet Gallery - http://gallery.technet.microsoft.com/scriptcenter/79644be9-b5e1-4d9e-9cb5-eab1ad866eaf

More Scripts - http://portal.sivarajan.com/search?q=script+powershell&max-results=20


SS

Santhosh Sivarajan

Microsoft MVP · Identity & Cybersecurity Architect

Santhosh has 30+ years of hands-on enterprise experience in Identity and Access Management, Microsoft Entra ID, Active Directory, Microsoft 365 and Zero Trust architecture. He is the author of two books on Windows Server and security, and leads consulting, assessments and training at SAG Business Group.

9 comments:

Is there a way for it to prompt for the password and then report the results in a csv file?

Sure. You can use Get-Credential cmdlet. See the logic from this script:

http://portal.sivarajan.com/2013/05/compare-source-and-target-mailbox.html

Hello Santhosh, Very Good Your Blog congratulations, could help me, I'm trying to heighten the credential for multiple services, it would be possible?

Thanks for the feedback Herbert Viana. What do you mean by "heighten the credential". Please provide more information here.

Change method is not working

Method invocation failed because [Selected.System.ServiceProcess.ServiceController] does not contain a method named 'change'.
At line:3 char:1
+ $sachin.change($null,$null,$null,$null,$null,$null,"sqldba/test","welcome@123",$ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (change:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

Do you want to write your love essay? All people have their unique understanding of the most serious human emotion they face each day because love is a mysterious or infinite universe. This topic is worthy of being admired or investigated. If you decide to write your essay about family love or similar subjects, you don’t have to be experienced in love affairs. Each person has something to say about this strong feeling.

Hello, I want to thank you for sharing this interesting information. This sample script will be helpful for my the best teacher i ever had. Thanks a lot.

the script has a mistake when starting the service it checking it's $changestatus instead of $startstatus and may give wrong data

Suchen Sie nach einem Medikament, das Ihnen helfen kann, Penisprobleme zu lösen? Dann sollten Sie auf jeden Fall versuchen, hier auf dieser Seite Siehe hier zu gehen , wo ich immer Probleme mit einem Mitglied lösen kann, ich bin sicher, dass Sie genau Erfolg haben werden

Post a Comment

Popular Posts
Workstation Trust Relationship Issue Issue: You receive the following error message, when you try to login to the domain.  The security database on the server does not have ... ADMT Service Account - Permission and Configuration The ADMT service account needs to have proper permission in source and target domains.  You don’t need to use 2 separate accounts.  You can ... My First Peek into Microsoft Exchange 2010 By Santhosh Sivarajan Before I really dive into Exchange 2010, I thought I would install and play with it first. I took some screen shots and notes during the ins... ObjectSID and Active Directory What is an objectSID in Active Directory? When a new object is created in Active Directory, Domain Controller assigns a unique value used ... AD Group Report - List Group Members in Active Directory–PowerShell Script Updated Script - http://portal.sivarajan.com/2011/10/search-ad-collect-local-admin-group.html Script #1 This script... Add Users to a Group–PowerShell Script Purpose – Add users to a group from an input file – PowerShell V2 Script.  Input file – Input file (Users.csv) contains samAccountName in... User Account Migration and Merging – Part I (ADMT) Part I - User Account Migration and Merging Using ADMT Part II - User Account Migration and Merging Using QMM pre-creating user account ... User Account Migration and Merging – Part II (Quest Migration Manager) Part I - User Account Migration and Merging Using ADMT Part II - User Account Migration and Merging Using QMM Pre-creating user account in... Delete Stale or Inactive Computer Accounts from Active Directory Here is an easy way to identify and delete inactive or stale computers in an Active Directory environment.  Using the dsquery command you c... Converting PowerShell (PS1) to EXE / Standalone Application As we know, there many applications available to convert a PowerShell file to a standalone executable file.  Based on my experience, PowerSh...