Are you sure your .ps1 file is saved as a UniCode file?
Or are there any "special" characters in the hostname?
there are no special characters in the hostname .. i tried with IP as well .. only with Script its giving me an issue.. on powercli command prompt it works fine...
appreciate your help
Can you try adding the Verbose switch on the Connect-VIServer cmdlet?
Hopefully by this time you have figured it out but still sharing my experience
Please make sure you don't have any space left after the host name in a txt file or csv file. I have had the same problem and it was found that after the VC name there was plenty of blank space. when i removed that then it worked well.