AddCollectorAccount method

Adds a collector account to the list of accounts allowed to access this audit store database.

Syntax

void AddCollectorAccount(
	string userName,
)

Parameters

Specify the following parameter when using this method.

Parameter Description

username

The user name of the collector account you want to add. For a Windows account, both domain users and local users are allowed. You must use the NT4 account format: domain\user or hostname\user, where domain must be in NetBIOS format. For a SQL login account, use only the user name.

Errors

The AddCollectorAccount method may throw one of the following exceptions:

  • Centrify.DirectAudit.Common.Logic.AuthenticationException if you do not have permission to connect to the Microsoft SQL Server instance or the management database.
  • Centrify.DirectAudit.Common.Logic.ConnectDatabaseException if you cannot connect to the Microsoft SQL Server instance either because the Microsoft SQL Server instance is not running and does not allow remote connections.
  • Centrify.DirectAudit.Common.Logic.UnauthorizedException if you do not have the Manage SQL Login permission on the audit store.

Discussion

When you attach a new database to the audit store, you must set the database to allow access by each collector account that passes data to that audit store. You can pass the collector’s Account.UserName property to this method as the user name.

Example

The following code sample illustrates using AuditStoreDatabase.AddCollectorAccount in a script:

...

' Copy Collector accounts from current active Audit Store database
SET objCollectorAccounts = objActiveDatabase.CollectorAccounts
FOR EACH objCollectorAccount IN objCollectorAccounts
objAuditStoreDatabase.AddCollectorAccount objCollectorAccount.UserName
wscript.echo "Added Collector account '" & objCollectorAccount.UserName & "'."
NEXT

See also