Lab 20 - PowerShell
Introduction
This lab walks you through the process of developing a script that in turn creates a webpage displaying statistics about your servers that every administrator should check daily. As such this relies on Chapter 19 pp. 694-704.
Lab Goals
Create a PowerShell script that performs the checking and verification processes found in the "Daily Maintenance" section. Have it produce an html page available on your IIS machine under the name of daily.html. It should have results for the following:
- Can users access data on file servers?
- Check to see if your file shares are available. Don't know where they are? Look it up in your documentation.
- Are the printer share(s) alive? What is their status? (e.g. online offline ...)
- Who has logged on in the last 24 hours.
- Can users access the internet?
- Verify Backups ... ok, we don't do backups for virtual machines through normal backup procedures, so we won't do this this time.
- Present Critical Events in event viewer.
Setup
Once you have created and tested the script, create a job that runs daily at 12:00 AM and put the output of your script in the root directory of your IIS server. I recommend that you do this using a share on your file server. I called mine www. Make sure Enterprise Admins have write permissions.
Your script must be signed by a certificate that is trusted by the server. I found that this site was useful: https://www.sharepointdiary.com/2020/12/how-to-sign-powershell-script.html.
Show Me
- Run the script and show me the output.
- Show that the script is setup to run daily at 12:00 AM
- Show that the IIS server shows the output of the script.