Method | Description | |
---|---|---|
GenerateRandomPassword ( int length ) : string |
Generates a random password that meets most of the requriements of Windows Server when password policy complexity requirements are in effect. http://technet.microsoft.com/en-us/library/cc786468%28v=ws.10%29.aspx This generates a string with at least two of each of the following character classes: uppercase letters, lowercase letters, and digits. However, this method does not check for the existence of the username or display name within the generated password. The probability of that occurring is somewhat remote, but could happen. If that is a concern, this method could be called repeatedly until a string is returned that does not contain the username or display name.
|
|
GetGroupPrincipal ( SecurityIdentifier sid ) : System.DirectoryServices.AccountManagement.GroupPrincipal | ||
GetGroupPrincipal ( string groupname ) : System.DirectoryServices.AccountManagement.GroupPrincipal |
Finds and returns the GroupPrincipal object if it exists, if not, returns null. This method uses PrincipalSearcher because it is faster than GroupPrincipal.FindByIdentity. The group name comparison is case insensitive.
|
|
GetUserDirectoryEntry ( string username ) : System.DirectoryServices.DirectoryEntry | ||
GetUserPrincipal ( SecurityIdentifier sid ) : System.DirectoryServices.AccountManagement.UserPrincipal | ||
GetUserPrincipal ( string username ) : System.DirectoryServices.AccountManagement.UserPrincipal |
Finds and returns the UserPrincipal object if it exists, if not, returns null. This method uses PrincipalSearcher because it is faster than UserPrincipal.FindByIdentity. The username comparison is case insensitive.
|
|
LocalAccount ( |
||
RemoveUserAndProfile ( string user, int sessionID ) : void | ||
ScrambleUsersPassword ( string username ) : void | ||
SyncLocalGroupsToUserInfo ( |
||
SyncToLocalUser ( ) : void | ||
SyncUserInfoToLocalUser ( |
||
UserExists ( string strUserName ) : bool |
This is a faster technique for determining whether or not a user exists on the local machine. UserPrincipal.FindByIdentity tends to be quite slow in general, so if you only need to know whether or not the account exists, this method is much faster.
|
Method | Description | |
---|---|---|
AddUserToGroup ( System.DirectoryServices.AccountManagement.UserPrincipal user, System.DirectoryServices.AccountManagement.GroupPrincipal group ) : void | ||
Connect2share ( string share, string username, string password, uint retry, System.Boolean DISconnect ) : System.Boolean | ||
CreateOrGetGroupPrincipal ( |
||
CreateOrGetUserPrincipal ( |
||
GetGroups ( System.DirectoryServices.AccountManagement.UserPrincipal user ) : List |
Returns a list of groups of which the user is a member. It does so in a fashion that may seem strange since one can call UserPrincipal.GetGroups, but seems to be much faster in my tests.
|
|
IsUserInGroup ( System.DirectoryServices.AccountManagement.UserPrincipal user, |
||
IsUserInGroup ( System.DirectoryServices.AccountManagement.UserPrincipal user, System.DirectoryServices.AccountManagement.GroupPrincipal group ) : bool | ||
IsUserInGroup ( string username, string groupname ) : bool | ||
LocalAccount ( ) : System | ||
RecurseDelete ( string directory ) : void | ||
RemoveUserFromGroup ( System.DirectoryServices.AccountManagement.UserPrincipal user, System.DirectoryServices.AccountManagement.GroupPrincipal group ) : void | ||
SMBserver ( string share, System.Boolean visversa ) : string[] | ||
SetACL ( |
||
SyncUserPrincipalInfo ( |
public static GenerateRandomPassword ( int length ) : string | ||
length | int | Password length, must be at least 6. |
return | string |
public static GetGroupPrincipal ( SecurityIdentifier sid ) : System.DirectoryServices.AccountManagement.GroupPrincipal | ||
sid | SecurityIdentifier | |
return | System.DirectoryServices.AccountManagement.GroupPrincipal |
public static GetGroupPrincipal ( string groupname ) : System.DirectoryServices.AccountManagement.GroupPrincipal | ||
groupname | string | |
return | System.DirectoryServices.AccountManagement.GroupPrincipal |
public static GetUserDirectoryEntry ( string username ) : System.DirectoryServices.DirectoryEntry | ||
username | string | |
return | System.DirectoryServices.DirectoryEntry |
public static GetUserPrincipal ( SecurityIdentifier sid ) : System.DirectoryServices.AccountManagement.UserPrincipal | ||
sid | SecurityIdentifier | |
return | System.DirectoryServices.AccountManagement.UserPrincipal |
public static GetUserPrincipal ( string username ) : System.DirectoryServices.AccountManagement.UserPrincipal | ||
username | string | The username to search for. |
return | System.DirectoryServices.AccountManagement.UserPrincipal |
public LocalAccount ( |
||
userInfo | ||
return | System |
public RemoveUserAndProfile ( string user, int sessionID ) : void | ||
user | string | |
sessionID | int | |
return | void |
public ScrambleUsersPassword ( string username ) : void | ||
username | string | |
return | void |
public static SyncLocalGroupsToUserInfo ( |
||
userInfo | ||
return | void |
public static SyncUserInfoToLocalUser ( |
||
userInfo | ||
return | void |
public static UserExists ( string strUserName ) : bool | ||
strUserName | string | The user name |
return | bool |