|
UserInfoAddUserToLocalGroup Method
|
Adds an existing user to the specified local groupName.
Namespace: GSF.IdentityAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.246-beta+ff392465a0262ee2737937d4127fc3c2f08c6dcd
Syntaxpublic static bool AddUserToLocalGroup(
string groupName,
string userName
)
Public Shared Function AddUserToLocalGroup (
groupName As String,
userName As String
) As Boolean
public:
static bool AddUserToLocalGroup(
String^ groupName,
String^ userName
)
static member AddUserToLocalGroup :
groupName : string *
userName : string -> bool
GSF.Identity.UserInfo.AddUserToLocalGroup = function(groupName, userName);
View SourceParameters
- groupName String
- Group name to add local user to.
- userName String
- Existing local user name.
Return Value
Booleantrue if user was added to local group; otherwise,
false meaning user was already in group.
ExceptionsException | Condition |
---|
ArgumentNullException | groupName or userName was null. |
ArgumentException | No groupName or userName was specified. |
InvalidOperationException | Could not add user to local group. |
Remarks
This function will handle Windows service virtual accounts by specifying the complete virtual account name,
such as @"NT SERVICE\MyService", as the userName. This function can also add
Active Directory user accounts and groups to the local group the when the userName is
prefixed with a domain name and a backslash "\".
See Also