RemoveApplicationAdministrator2

Removes a user from the Application Administrator role.

Syntax

<HsvSecurityAccess>.RemoveApplicationAdministrator2 bstrUserSID

Argument

Description

bstrUserSID

String (ByVal). The security identifier of the user to be removed.

Example

The following snippet removes the Jsmith username from the Application Administrator role. EnumApplicationAdministrators2 gets the security identifiers of all the application Administrators. The loop tests whether Jsmith’s security identifier is in the array of Administrators’ security identifiers; if so, Jsmith is removed from the Application Administrator role.

Dim cSecurity As HsvSecurityAccess, sSID As String, vaUserIDs, vaNames
'g_cSession is an HsvSession object reference
Set cSecurity = g_cSession.Security
cSecurity.GetUserSID "myserver\Jsmith", sSID
cSecurity.EnumApplicationAdministrators2 vaUserIDs, vaNames
For i = LBound(vaUserIDs) To UBound(vaUserIDs)
  If vaUserIDs(i) = sSID Then
    cSecurity.RemoveApplicationAdministrator2 sSID
  End If
Next i