Search code examples
windowspowershellclearcase

How to change windows services account domain name and password using powershell script?


We are in the ClearCase windows domain migration phase. Now we migrated the domain but how to change clearcase_albd account domain name and password using power-shell script in user machine. I'm very new to powershell scripting.

Old Domain Name: Old_Domain
New Domain Name: New_Domain

Old Account: dragon
New Account: dragon_fire

I googled it but it didn't help me. Thanks in advance.


Solution

  • First find your service:

    $service = gwmi win32_service -computer [computername] -filter "name='service name'"
    

    And then set the credentials:

    $service.change($null,$null,$null,$null,$null,$null,"username","password")
    

    Or use the script: https://blogs.msdn.microsoft.com/amantaras/2014/12/10/powershell-script-to-change-windows-service-credentials/