public class WinUser
extends java.lang.Object
If a helper process with elevated privileges has been created by the "Request privileges" action, the methods of this class are pushed to the helper process. Please see the help topic on "Elevation Of Privileges" for more information.
Modifier and Type | Class and Description |
---|---|
static class |
WinUser.AddUserResult
The class of the objects returned by
addUser(java.lang.String, java.lang.String, java.lang.String, com.install4j.api.windows.WinUser.GroupCreationMode, java.lang.String, java.lang.String) . |
static class |
WinUser.AddUserResultType
|
static class |
WinUser.GroupCreationMode
The group creation mode.
|
Constructor and Description |
---|
WinUser() |
Modifier and Type | Method and Description |
---|---|
static WinUser.AddUserResult |
addUser(java.lang.String name,
java.lang.String password,
java.lang.String comment,
WinUser.GroupCreationMode groupCreationMode,
java.lang.String localGroupNameOrSid,
java.lang.String localGroupComment)
Add a user and optionally a local group.
|
static boolean |
deleteLocalGroup(java.lang.String nameOrSid)
Delete a local group.
|
static boolean |
deleteUser(java.lang.String nameOrSid)
Delete a user.
|
static java.lang.String |
getAccountName(java.lang.String sid)
Try to get an account name for a SID (Security Identifier).
|
static java.lang.String |
getUserName(java.lang.String sid)
Try to get the user name (an unqualified account name) for a SID (Security Identifier).
|
static java.lang.String |
getUserSid()
Get the users SID (Security Identifier) of the current process.
|
public static boolean deleteUser(java.lang.String nameOrSid)
nameOrSid
- an account name or a SID in String formtrue
if successful or if the user doesn't existpublic static boolean deleteLocalGroup(java.lang.String nameOrSid)
nameOrSid
- an account name or a SID in String formtrue
if successful or if the local group doesn't existpublic static WinUser.AddUserResult addUser(java.lang.String name, java.lang.String password, java.lang.String comment, WinUser.GroupCreationMode groupCreationMode, java.lang.String localGroupNameOrSid, java.lang.String localGroupComment)
name
- the user namepassword
- the password for the accountcomment
- an optional comment. Can be null
groupCreationMode
- how the group should be createdlocalGroupNameOrSid
- a group name or optionally a SID if the group already exists. Can be null
for WinUser.GroupCreationMode.NONE
.localGroupComment
- an optional comment for the local group. Can be null
public static java.lang.String getAccountName(java.lang.String sid)
sid
- the SID in String formnull
if the account could not be found.public static java.lang.String getUserName(java.lang.String sid)
sid
- the SID in String formnull
if the account could not be found.public static java.lang.String getUserSid()
null
if the method fails.