It’s time for Demo 2 – Administering Servers in Bulk. I’ve attached the 4 scripts that I used.
Demo 2 – Administering Servers in Bulk
BulkServers1.ps1 – This script reads in a text file, containing 1 server per line. It simply then writes the server names back to the console
BulkServers2.ps1 – This script extends the first script and simply gets the hostname, operating system and service pack level for each server listed in the input file.
BulkServers3.ps1 – This script gets a little bit more complex and in fact is rather exciting. It again reads an input file and for each server, gets operating system information, bios information, writes this to a CSV file and then opens the csv file in your default CSV file handler.
BulkServers4.ps1 – The piece de resistance! This script is very similar to the above script, except that rather than read an input file with server names, it connects to the Domain Controller container in the Active Directory, and gets information from all computers in that container.
Please note, there is no error checking in these scripts, and are purely working illustrations. I would flesh these scripts out a bit more before I used them in anything other than a test infrastructure.
All done, stay tuned for Demo 3 – How Do I Know Which Classes to Use
That is all.