Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
When you assign an account to a service, the SCM requires the correct password for that account before it makes the assignment. If you supply an incorrect password, the SCM rejects the account. If you configure a service account using the LocalSystem, LocalService, or NetworkService account, you do not need to supply an account password because these accounts do not have passwords.
The SCM stores the account password in the services database. After the password is assigned, however, the SCM does not ensure that the password stored in the services database and the password assigned to the user account in Active Directory continue to match. Consequently, a situation similar to the following could occur:
If you run services under regular user accounts, you need to update those service passwords each time the user account password changes. This can be particularly time-consuming if you are not sure which services are running under that account or which computers have services running under that account.
Fortunately, you can use WMI to check the service accounts on all your computers and, if necessary, change the service account password.
Listing 15.21 contains a script that changes the service account password for all scripts running under Netsvc. To carry out this task, the script must perform the following steps:
When using the Change method, the password must be the eighth parameter passed to the method. Because of this, the password is preceded by seven empty arguments (represented by the seven commas). Unless you are using a variable, the password must be enclosed in quotation marks.
Listing 15.21 Changing a Service Account Password
|
|
Send us your feedback | « Previous | Next » |