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 `