AFSecurity.GetAccountNameForSID Method (SecurityIdentifier, Boolean, String)
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
Helper method to return the Windows Account name for a security identifier (SID) on a remote machine.
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static string GetAccountNameForSID( SecurityIdentifier sid, bool invariant, string machineName )
Public Shared Function GetAccountNameForSID ( sid As SecurityIdentifier, invariant As Boolean, machineName As String ) As String Dim sid As SecurityIdentifier Dim invariant As Boolean Dim machineName As String Dim returnValue As String returnValue = AFSecurity.GetAccountNameForSID(sid, invariant, machineName)
public: static String^ GetAccountNameForSID( SecurityIdentifier^ sid, bool invariant, String^ machineName )
static member GetAccountNameForSID : sid : SecurityIdentifier * invariant : bool * machineName : string -> string
Parameters
- sid
- Type: System.Security.PrincipalSecurityIdentifier
The security identifier (SID) to convert to an account name. - invariant
- Type: SystemBoolean
If , the invariant name of the built-in accounts will be returned. - machineName
- Type: SystemString
The name of the remote machine to be used as the context for resolving the sid. To use the local machine, specify .
Return Value
Type: StringThe account name associated with the SID. If no account name is found, the SID is returned in string form.