"The remote server returned an error: (407) Proxy Authentication" - This is another issue I faced when working with VMware PowerCLI, Although I had already resolved another error in VMware PowerCLI Connect-VIserver Could not connect using the requested protocol, Only the difference was it was not connection error but throwing error when running PowerCLI cmdlets. Example Get-VM or Get-VMHost, Since I was received different error with different cmdlet (operation) so I thought documenting it as a troubleshooting guide for my Team Members.
Get-VM
Get-VM : 5/21/2021 7:04:05 PM Get-VM The remote server returned an error: (407) Proxy Authentication
Required.
At line:1 char:1
+ Get-VM
+ ~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-VM], ViError
+ FullyQualifiedErrorId : Client20_QueryServiceImpl_RetrievePropertiesEx_ViError,VMware.VimAutomation.ViCore.Cmdle
ts.Commands.GetVM
Get-VM : 5/21/2021 7:04:05 PM Get-VM The remote server returned an error: (407) Proxy Authentication
Required.
At line:1 char:1
+ Get-VM
+ ~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-VM], ViError
+ FullyQualifiedErrorId : Client20_QueryServiceImpl_RetrievePropertiesEx_ViError,VMware.VimAutomation.ViCore.Cmdle
ts.Commands.GetVM
To start troubleshoot, I checked the current configuration of PowerCLI, it indicated Session Scope is using UseSystemProxy as ProxyPolicy.
C:\PS>Get-PowerCLIConfiguration Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTimeout Seconds ----- ----------- ------------------- ------------------------ -------------------------- ------------------- Session UseSystemProxy Multiple Ignore True 300 User Multiple AllUsers Ignore
Changed the Session scope to use NoProxy with below one-liner command. I had used same steps to resolve other issue VMware PowerCLI Connect-VIserver Could not connect using the requested protocol.
C:\PS>Set-PowerCLIConfiguration -ProxyPolicy NoProxy -Scope Session Perform operation? Performing operation 'Update vSphere PowerCLI configuration.'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTimeout Seconds ----- ----------- ------------------- ------------------------ -------------------------- ------------------- Session NoProxy Multiple Ignore True 300 User Multiple AllUsers Ignore
Once the ProxyPolicy is configured, I ran few PowerCLI commands to verify and it is was successful.
Useful Articles
VMWARE VCENTER 6.5 UPGRADATION ERROR
THERE WAS ERROR CONNECTING VMWARE VSPHERE UPDATE MANAGER [VCENTER:443] DATABASE TEMPORARILY UNAVAILABLE OR HAS NETWORK PROBLEMS
WINDOWS VCENTER 6.5: VCENTER VPXD AND OTHER SERVICES MISSING OR NOT EXIST IN SERVICES.MSC
RESOLVED : ADDING VIRTUAL HARD DISK GRAYED OUT ON VIRTUAL MACHINE
VMware hot-extend was invoked with size is not supported: Virtual Machine HDD VMDK
RESOLVED : FAIL TO DEPLOY OVF TEMPLATE - TASK CANCELED BY USER
VMWare Web Client: Datastore browse files upload copy failed error