piszczynski>Aleks |
piszczynski>Aleks No edit summary |
||
Line 9: | Line 9: | ||
*$pw = Read-Host "password" -AsSecureString | *$pw = Read-Host "password" -AsSecureString | ||
**Set-ADAccountPassword <username> -Reset -NewPassword $pw | **Set-ADAccountPassword <username> -Reset -NewPassword $pw | ||
Search for adusers using powershell: | |||
Can be used with various options: DistinguishedName, Enabled, GivenName, Name, ObjectClass, Object GUID, SamAccountName, SID, Surname, UserPrincipalName. | |||
*get-aduser -filter "name -eq '<name of user>'" |
Revision as of 12:20, 23 July 2021
Active Directory
Handy PowerShell script to add AD group members from one group to another:
Add-ADGroupMember -Identity 'New Group' -Members (Get-ADGroupMember -Identity 'Old Group' -Recursive)
Reset password in powershell
- $pw = Read-Host "password" -AsSecureString
- Set-ADAccountPassword <username> -Reset -NewPassword $pw
Search for adusers using powershell:
Can be used with various options: DistinguishedName, Enabled, GivenName, Name, ObjectClass, Object GUID, SamAccountName, SID, Surname, UserPrincipalName.
- get-aduser -filter "name -eq '<name of user>'"