removed old hosts, added verbose parameter, and error action preference to stop

This commit is contained in:
2023-05-14 13:28:49 -04:00
parent ec5b88285c
commit 9ca89e69ca

View File

@@ -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 `