Hi LuCD,
Thank you, that fixed my issue.
I added $global:defaultviservers = " " after the Disconnect-VIServer $server -Confirm:$false and it did the trick. It this the correct way to do this or do you recommend another way.
$esxiServers = Get-Content c:\temp\esxiServers.txt
ForEach ($server in $esxiServers)
{
Connect-VIServer $server
Write-Host "Processing $server ..." -BackgroundColor Yellow -ForegroundColor Red
$userNames = Get-VIAccount
ForEach ($user in $userNames)
$server + "," + $user.ID + "," + $user.Name | Out-File c:\temp\esxiUserList.txt -Append
Disconnect-VIServer $server -Confirm:$false
$global:defaultviservers = " "
}