$VMHostNames = @"
itdvmmdnwin11.nd.gov
itdvmmdnwin12.nd.gov
"@
$VMHostNames = ConvertTo-Array -MultiLineString $VMHostNames

ForEach ($VMHostName in $VMHostNames) {
    $RootCred = $null
    $RootCred = Get-ITDPassword -Title $VMHostName -UserName root -Credential $PrvCred

    Disable-ITDVMwareVMHostFeature -Name $VMHostName -LockdownMode

    $null = Connect-VIServer $VMHostName -Credential $RootCred

    If (-not ($?)) {
        Write-Warning ($VMHostName + " password failed")
    }
    else {
        Disconnect-VIServer $VMHostName -Force -Confirm:$false
    }
    Enable-ITDVMwareVMHostFeature -Name $VMHostName -LockdownMode
}


$VMHostNames = @"
itdvmmdnwin11.nd.gov
itdvmmdnwin12.nd.gov
"@
$VMHostNames = ConvertTo-Array -MultiLineString $VMHostNames
$VmDefaultCred = Get-Secret VMDefault
ForEach($VMHostName in $VMHostNames){
    Disable-ITDVMwareVMHostFeature -Name $VMHostName -LockdownMode
    $VMHostCred = Get-ITDPassword -Title $VMHostName -UserName root -Credential $PrvCred
    Connect-VIServer -Server $VMHostName -Credential $VmDefaultCred
    Set-VMHostAccount -Server $VMHostName -UserAccount root -Password $VMHostCred.GetNetworkCredential().Password
    Disconnect-VIServer -Server $VMHostname -Confirm:$false
    Enable-ITDVMwareVMHostFeature -Name $VMHostName -LockdownMode
}