ServiceAccount.UserDomainAccount
[This documentation is preliminary and is subject to change.]
The UserDomainAccount property retrieves an object that contains the account credentials.
Property UserDomainAccount As UserDomainAccount
Property Value
This property returns a UserDomainAccount object. You can use this object to specify or return the following properties.
Property | Description |
---|---|
Domain | Specifies or retrieves the account domain name. |
Password | Specifies or retrieves the account password. |
UserId | Specifies or retrieves the account user ID. |
Example Code
DIM config_manager
DIM admin_role
' *******************************************************************
' Create and initialize a ConfigurationManager object.
SUB InitObject()
CALL WScript.Echo( "Create ConfigurationManager object...")
SET config_manager = CreateObject _
("Microsoft.RightsManagementServices.Admin.ConfigurationManager")
CheckError()
CALL WScript.Echo( "Initialize...")
admin_role=config_manager.Initialize(false,"localhost",80,"","","")
CheckError()
END SUB
' *******************************************************************
' Retrieve the current account and change it.
SUB ChangeServiceAccount()
DIM chngMgr
DIM newAcct
DIM dType
dType = config_manager.Constants.ServiceAccountTypeDomainIdentity
' Create a ServiceIdentity object that can be used to change the
' service account.
SET chngMgr = config_manager.ServiceIdentity
CheckError()
' Create a new account.
SET newAcct = chngMgr.NewServiceAccount
CheckError()
newAcct.Type = dType
newAcct.UserDomainAccount.Domain = "domain_name"
newAcct.UserDomainAccount.UserId = "User_id"
newAcct.UserDomainAccount.Password = "password"
' Update service account with the new account information.
chngMgr.Update()
CheckError()
END SUB
' *******************************************************************
' Error checking function.
FUNCTION CheckError()
CheckError = Err.number
IF Err.number <> 0 THEN
CALL WScript.Echo( vbTab & "*****Error Number: " _
& Err.number _
& " Desc:" _
& Err.Description _
& "*****")
WScript.StdErr.Write(Err.Description)
WScript.Quit( Err.number )
END IF
END FUNCTION
Requirements
Product | Requires Windows Server "Longhorn". |
Library | Use Microsoft.RightsManagementServices.Admin.dll registered as a custom type library. |