Windows PowerShell - Save and Reuse Credentials
The following script saves credentials for the servers listed in the CSV file.
CSV File (The SecureString property is created when the above script is run):
The following script uses the stored credentials to monitor the servers stored in the CSV file:
The script below uses the IP Address, but the Hostname could be used instead if DNS were configured properly.