driver_utils.ps1
function Enable-HostSecurity($HostName, $DatastoreName, $BiosUuid) { Write-Host "Starting $($MyInvocation.MyCommand)..." $datastoreUuid = Get-DatastoreUUID($DatastoreName) $scriptPath = ('{0}/zexec_installed_only_set.sh' -f $ZERTO_FOLDER_ON_HOST) $fileRemoteDir = ("/vmfs/volumes/{0}/zagentid/{$BiosUuid}", $datastoreUuid); $Commands = ('chmod a+x {0}' -f $scriptPath), ('OUT=`{0} enable {1}`; EXIT_STATUS=$?; echo $OUT >> /etc/vmware/zloadmod.txt; echo $EXIT_STATUS;' -f $scriptPath, $fileRemoteDir) $sshResult = Invoke-SSHCommands -HostName $HostName -Commands $Commands Write-Host "SSH result:" + $sshResult["1_output"] $exitStatus = $sshResult["1_output"] $exitStatus = if ($exitStatus) { $exitStatus } else { "" } $hasErrors = ($exitStatus.Trim() -ne "0") if ($hasErrors) { throw "Failed to enable host security for $HostName" } } |