Active Directory PowerShell Blog
- Hits: 1019
Create Local Admin Account
This is a script that your not going to need everyday but it could come in handy. I had a situation at one of my clients that required us to allow a consultant team to log on to servers during a migration process with local admin privileges. Obviously if your security team is OK with it you could just give the consultants the password for your local admin account in your environment. You could also temporarily change the default admin account password and then change it back if you wanted. We could not do either of those things for one reason or another so this script was born.
The script takes a name you set in the variable called “$NewLocAdmin” and processes through a list of servers you populate in a file named “ServersList.txt” and creates a local user and adds it to the local Administrators group. The “ServersList.txt” will need to exist in the same directory as the script unless you update the “$Computers” variable. The script prompts for the password to be given to the new account. If in your environment you have renamed the local Administrators group on your machines you will need to change where it where it is referenced in the script as well.
- Hits: 1035
This script grads a list of web sites you place in a file called "serverslist.txt" which should exist in the same directory as the PowerShell script. It takes the web sites and queries them for there certificate information. Any sites that have a certificate that expires in 30 days or less are reported on. The report consist of an email sent using Send-MailMessage. Your going to need a mail server to route your SMTP message send through.
- Hits: 1069
PowerPing is a short script that uses the test-connection cmdlet to run through a text file based list of servers. The list is processed and a CSV file is generated giving the status for each server it ran against. It is pretty simple and will work as long as you are running PowerShell 3.0 and higher since it requires the Test-Connection cmblet to be avilable.