ServiceIdentity.Update

[This documentation is preliminary and is subject to change.]

The Update method updates a new service account to the server.

Sub Update()

Parameters

This method has no parameters.

Return Value

This method does not return a value.

Remarks

Updating replaces the account previously contained in the RMS Service Group with the new account. This method performs the following tasks:

  • Grants database access to the service account.
  • Saves the account in the configuration database.
  • Changes the logging database service account to match.
  • Changes the IIS service account.
  • Changes the logging service account.
  • Changes the Microsoft Message Queuing (MSMQ) service account.
  • Adds the user to the local database service group.

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 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.

See Also

ServiceIdentity