From 9ca89e69ca5f5cd3e72edcfde9cd9ca395c0a8e3 Mon Sep 17 00:00:00 2001 From: John Gaunt Date: Sun, 14 May 2023 13:28:49 -0400 Subject: [PATCH] removed old hosts, added verbose parameter, and error action preference to stop --- Backup ESXi Host Configurations.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Backup ESXi Host Configurations.ps1 b/Backup ESXi Host Configurations.ps1 index 255e6b7..6739105 100644 --- a/Backup ESXi Host Configurations.ps1 +++ b/Backup ESXi Host Configurations.ps1 @@ -4,14 +4,14 @@ #Start-Transcript "C:\Users\Veeam_Service\Desktop\Backup ESXi Host Configurations.log" +# make sure to stop on an error +$ErrorActionPreference = "Stop" + # host array to backup $esxiHosts = @( "gauntesxi01.home.johnhgaunt.com" "gauntesxi02.home.johnhgaunt.com" "gauntesxi03.home.johnhgaunt.com" - "gauntesxi04.home.johnhgaunt.com" - "gauntesxi05.home.johnhgaunt.com" - "gauntesxi06.home.johnhgaunt.com" ) # Loop through each host @@ -27,7 +27,7 @@ foreach ($esxiHost in $esxiHosts) { new-item -ItemType Directory -Path $backupFolder -ErrorAction SilentlyContinue # Get the credentials for the host - $credentials = Get-VICredentialStoreItem -Host $esxiHost + $credentials = Get-VICredentialStoreItem -Host $esxiHost -Verbose # Connect to the host Connect-VIServer -server $esxiHost `