Starting to collect some PowerShell scripts for references. There are lots of them can be found from the references section.
Table of Contents
Export a Computer List from Active Directory
Open the Powershell ISE → Run the following script, adjusting the path for the export:
Step 2: Source Code (One Line)
Get-ADComputer -Filter * -Property * | Select-Object Name,OperatingSystem,OperatingSystemVersion,ipv4Address | Export-CSV ADcomputerslist.csv -NoTypeInformation -Encoding UTF8
Reset Domain User’s Password
1. Using Powershell
Set-ADAccountPassword -Identity admin2 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Cyberark1" -Force)
Set-ADAccountPassword -Identity admin3 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Cyberark1" -Force)
Set-ADAccountPassword -Identity auditor1 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Cyberark1" -Force)
Set-ADAccountPassword -Identity auditor2 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Cyberark1" -Force)
Set-ADAccountPassword -Identity test1 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Cyberark1" -Force)
Set-ADAccountPassword -Identity test2 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Cyberark1" -Force)
Set-ADAccountPassword -Identity test3 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Cyberark1" -Force)
Set-ADAccountPassword -Identity vaultadmin1 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Cyberark1" -Force)
Set-ADAccountPassword -Identity vaultadmin2 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Cyberark1" -Force)
2. Use Command Prompt
net user /domain USERNAME NEWPASS.
Run command prompt as administrator:
C:\Windows\system32>net user /domain admin2 Cyberark1
The command completed successfully.
C:\Windows\system32>
Replace USERNAME and NEWPASS with the actual username and a new password for this user.If the actual username consists of more than two words, place it inside quotation marks.
References
- /u/jacfearsome https://github.com/JacFearsome/powershell-scripts
- /u/PowerMonkey500 https://github.com/AndrewEllis93/PowerShell-Scripts
- /u/unibody https://github.com/jwmoss/powershell_scripts
- /u/IDA_noob https://github.com/tylerapplebaum?tab=repositories
- /u/mikedopp https://github.com/mikedopp
- /u/JBear_Alpha https://github.com/Average-Bear
- /u/BornToBeRoot https://github.com/BornToBeRoot/PowerShell
- /u/ramblingcookiemonste https://github.com/RamblingCookieMonster/PowerShell
- /u/jhulbe https://github.com/jhulbe/Powershell
- jrussellfreelance/powershell-scripts
from Blogger http://blog.51sec.org/2021/02/windows-powershell-script-collection.html