≡ Menu

Suppressing Warning message when running Connect-VIServer cmdlet

When connecting to VI server using Connect-VIServer cmdlet in VMware vSphere PowerCLI, you might notice a warning message about certificates. The warning message looks something like below.

WARNING: There were one or more problems with the server certificate:

A certificate chain processed correctly, but terminated in a root certificate which isn’t  trusted by the trust provider.

The certificate’s CN name  does not match the passed value.

Basically this warns about certificates that are installed on the VI server. This is expected behavior if you are using default(self signed) certificates. While this is a just warning message and doesn’t cause any issues to the powershell cmdlets functionality, it is not something you want to see when you run scripts. This really distracts the attention and the useful information might get burried under this lenghty warning message.

So in this post, I will show you how to suppress this message while connecting to VI server.

There are several ways available to do this.

1) Using -Force parameter

If you use -Force parameter with your Connect-VIserver cmdlet, these messages will be suppressed.

Connect-VIServer -Server VC1 -Force

2) Using -WarningAction parameter

You can suppress the warning message by setting -WarningAction parameter to SilentlyContinue(0) while calling Connect-VIServer cmdlet

Connect-VIServer -Server VC1 -WarningAction 0

3) Fixing the root cause

You are presented with a warning message because there is a problem that you should address. You need to import proper certificates into your VI server to get rid this warning message once for ever.

Please see http://www.vmware.com/pdf/vi_vcserver_certificates.pdf for the procedure to replace virtual center certificates.

Hope this helps…