ServiceAccount.ToString

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

The ToString method retrieves the localized account name.

Function ToString()

Parameters

This method has no parameters.

Return Value

This method returns a string value that contains the localized name of the account. If the account is a domain account, the format of the string is Domain_name\User_name.

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.

SUB GetCurrentSvcAccnt()

  DIM AcctMgr
  DIM currentAcct

  ' Create a ServiceIdentity that can be used to change the 
  ' service account.
  SET AcctMgr = config_manager.ServiceIdentity
  CheckError()

  ' Retrieve the current service account.
  SET currentAcct = AcctMgr.CurrentServiceAccount
  CheckError()

  ' Print the name of the account.
  CALL WScript.Echo( "Account = " & currentAcct.ToString())
  
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

ServiceAccount