11 Replies Latest reply on Dec 5, 2018 11:01 PM by mkfm

    Open-VMConsoleWindow Authorize Exception

    MBreidenbach0 Hot Shot

      Just noticed that Open-VMConsoleWindow no longer works ? Or did something change that I'm not aware of ? I can run VMRC from vSphere Web Client; also from PowerShell using this approach.

       

      PS C:\PowerCLI\_> get-vm xxxx | Open-VMConsoleWindow

      Open-VMConsoleWindow : A general system error occurred: Authorize Exception

      In Zeile:1 Zeichen:23

      + get-vm xxxx | Open-VMConsoleWindow

      +               ~~~~~~~~~~~~~~~~~~~~

          + CategoryInfo          : NotSpecified: (:) [Open-VMConsoleWindow], VimException

          + FullyQualifiedErrorId : VMware.Vim.VimException,VMware.VimAutomation.ViCore.Cmdlets.Commands.OpenVMConsoleWindow

       

      Some info:

      Windows 10 1803

       

      PS C:\PowerCLI\_> $PSVersionTable.PSVersion

       

      Major  Minor  Build  Revision

      -----  -----  -----  --------

      5      1      17134  228

       

      PS C:\PowerCLI\_> Get-PowerCLIModules

       

      Name                                Version

      ----                                -------

      VMware.DeployAutomation             6.7.0.8250345

      VMware.ImageBuilder                 6.7.0.8250345

      VMware.PowerCLI                     11.0.0.10380590

      VMware.Vim                          6.7.0.10334489

      VMware.VimAutomation.Cis.Core       11.0.0.10335701

      VMware.VimAutomation.Cloud          11.0.0.10379994

      VMware.VimAutomation.Common         11.0.0.10334497

      VMware.VimAutomation.Core           11.0.0.10336080

      VMware.VimAutomation.HA             6.5.4.7567193

      VMware.VimAutomation.HorizonView    7.6.0.10230451

      VMware.VimAutomation.License        10.0.0.7893904

      VMware.VimAutomation.Nsxt           11.0.0.10364044

      VMware.VimAutomation.PCloud         10.0.0.7893924

      VMware.VimAutomation.Sdk            11.0.0.10334495

      VMware.VimAutomation.Security       11.0.0.10380515

      VMware.VimAutomation.Srm            10.0.0.7893900

      VMware.VimAutomation.Storage        11.0.0.10380343

      VMware.VimAutomation.StorageUtility 1.3.0.0

      VMware.VimAutomation.Vds            11.0.0.10336077

      VMware.VimAutomation.Vmc            11.0.0.10336076

      VMware.VimAutomation.vROps          10.0.0.7893921

      VMware.VumAutomation                6.5.1.7862888

        • 1. Re: Open-VMConsoleWindow Authorize Exception
          LucD Guru
          Community WarriorsUser ModeratorsvExpert

          Did you configure a 32-bit web browser with Set-PowerCIiConfiguration?

          Is the VMRC plugin installed for that browser?

          More setup info in Opening the Virtual Machine Remote Console through PowerCLI

          1 person found this helpful
          • 2. Re: Open-VMConsoleWindow Authorize Exception
            MBreidenbach0 Hot Shot

            Thanky you very much for replying.

             

            So lets do some checking and tests.

             

            Seems its configured to use MSIE:

             

            PS C:\PowerCLI\_> get-powercliconfiguration | fl

             

            DefaultVIServerMode         : Multiple

            ProxyPolicy                 : UseSystemProxy

            ParticipateInCEIP           : False

            CEIPDataTransferProxyPolicy : UseSystemProxy

            DisplayDeprecationWarnings  : False

            InvalidCertificateAction    : Ignore

            WebOperationTimeoutSeconds  : 300

            VMConsoleWindowBrowser      : C:\Program Files\Internet Explorer\iexplore.exe

            Scope                       : Session

             

             

            DefaultVIServerMode         :

            ProxyPolicy                 :

            ParticipateInCEIP           : False

            CEIPDataTransferProxyPolicy :

            DisplayDeprecationWarnings  : False

            InvalidCertificateAction    : Ignore

            WebOperationTimeoutSeconds  :

            VMConsoleWindowBrowser      :

            Scope                       : User

             

             

            DefaultVIServerMode         : Multiple

            ProxyPolicy                 :

            ParticipateInCEIP           :

            CEIPDataTransferProxyPolicy :

            DisplayDeprecationWarnings  :

            InvalidCertificateAction    :

            WebOperationTimeoutSeconds  :

            VMConsoleWindowBrowser      : C:\Program Files\Internet Explorer\iexplore.exe

            Scope                       : AllUsers

             

            So I tested:

            via MSIE log into https://vcenter/ui (which is 6.5U1 until I get backup support for 6.7U1)

            select VM

            open web console - OK

            open VMRC - OK

             

            Other installed browsers are Chrome and Firefox 64 bit. Usually I use Chrome to access web client.

             

            Fun fact:

            Just tried this on my Mac. Get the message that PowerShell Core doesn't support Open-VMConsoleWindow. But using the other approach  works

             

            function Open-MyVMConsoleWindow {

             

            <#

                .Synopsis

                Function to replicate Open-VMConsoleWindow but use the VMware Remote Console Application

                .Description 

                Connect to the virtual machine using the currently connected server object.

                .Example

                Get-VM "MyVM" | Open-MyVMConsoleWindow

                .Parameter VirtualMachine

                Virtual Machine object

                .notes

                csdibiase 2016 https://communities.vmware.com/thread/539980 

                PowerCLI 5.5R1: Open-VMConsoleWindow

            #>

                [CmdletBinding()]

                param (

                    [Parameter(Mandatory=$true,ValueFromPipeline=$True)]

                    [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]$vm

                )

               

                process {

                    $ServiceInstance = Get-View -Id ServiceInstance

                    $SessionManager  = Get-View -Id $ServiceInstance.Content.SessionManager

                    $vmrcURI = "vmrc://clone:" + ($SessionManager.AcquireCloneTicket()) + "@" + $global:DefaultVIServer.Name + "/?moid=" + $vm.ExtensionData.MoRef.Value

                    Start-Process -FilePath $vmrcURI

                }

            }

            • 3. Re: Open-VMConsoleWindow Authorize Exception
              LucD Guru
              Community WarriorsUser ModeratorsvExpert

              That is correct Open-VMConsoleWindow is not supported in PSv6 (which is the one that runs on Mac and Linux).

               

              I was able to recreate your issue.

              On a vCenter that has a self-signed certificate I get the same Authorize exception.
              On a vCenter that has a "real" certificate, I don't get the error.
              And my PowerCLI session is configured to "ingnore" invalid certificates. So that seems to be an "issue".

               

              Btw, it looks as if there no more browser in play in the later PowerCLI versions (I tested with PowerCLI 11.0.0).
              The vmrc.exe is included in the VMware.VimAutomation.Core module.
              Note that it is only included in the net45 branch and not in the netcoreapp2.0, which explains why it will not work on PSv6 (Linux & MAc)

               

              That gave me the opportunity to roll my own Open-VmConsoleWindow as a bypass.

              The following seems to work for me, even with self-signed certificates.

              This is vSphere 6.5, PowerCLI 11.0.0 and VMRC 10.0.3 (that comes with the PowerCLI module)

               

              $vmName = 'MyVM'

               

              $moduleName = 'VMware.VimAutomation.Core'

              $module = Get-Module -Name $moduleName -ListAvailable

              $vmrcPath = "$($module.ModuleBase)\net45\VMware Remote Console\vmrc.exe"

               

              $vm = Get-VM -Name $vmName

              $mks = $vm.ExtensionData.AcquireMksTicket()

               

              $parm = "vmrc://$($vm.VMHost.Name):902/?mksticket=$($mks.Ticket)&thumbprint=$($mks.SslThumbPrint)&path=$($mks.CfgFile)"

               

              & "$vmrcPath" $parm

               

              1 person found this helpful
              • 4. Re: Open-VMConsoleWindow Authorize Exception
                LucD Guru
                User ModeratorsCommunity WarriorsvExpert

                The older method you included in your previous reply will only work if you have the VMRC plugin installed in your default browser.

                My code does not need the browser plugin anymore (like the current PowerCLI version).

                1 person found this helpful
                • 5. Re: Open-VMConsoleWindow Authorize Exception
                  MBreidenbach0 Hot Shot

                  Thank you very much.

                   

                  The vCenter certificate in my case isn't self signed; I've got a Windows CA; VMCA is configured as subordinate CA and I added the certificate of the windows ca as trusted CA. Chrome etc say its 'OK'.

                   

                  Set-PowerCLIConfiguration to warn... and it tells me the vCenter certificate is invalid since it can't access the CRL. Which is correct; this is a lab environment and I didn't care about CRLs until now (which would be BAD in a production environment).

                  • 6. Re: Open-VMConsoleWindow Authorize Exception
                    LucD Guru
                    vExpertCommunity WarriorsUser Moderators

                    Ok, that makes sense.

                     

                    Did you test my script?
                    On a station where the VMRC browser plugin is not installed?
                    The script should be in theory be completely browser independent.

                    1 person found this helpful
                    • 7. Re: Open-VMConsoleWindow Authorize Exception
                      MBreidenbach0 Hot Shot

                      Just tested your code; it works well (as always).

                       

                      Added a function Open-LucDVMConsoleWindow to my module collection

                      • 8. Re: Open-VMConsoleWindow Authorize Exception
                        MBreidenbach0 Hot Shot

                        BTW if there are old module versions it throws an error. Changed it to select the latest one:

                         

                        $module = Get-Module -Name $moduleName -ListAvailable | Sort-Object -Property 'Version' | Select-Object -Last 1

                        • 9. Re: Open-VMConsoleWindow Authorize Exception
                          LucD Guru
                          User ModeratorsvExpertCommunity Warriors

                          Nice catch.
                          I throw older versions away when I install a new PowerCLI version.
                          Remove -WhatIf if you are sure the correct modules are selected.

                           

                          Get-Module -Name VMware* -ListAvailable |

                          Group-Object -Property Name | where{$_.Count -gt 1} | %{

                              $_.Group | Sort-Object -Property Version -Descending | Select -Skip 1 | %{

                                  Uninstall-Module -Name $_.Name -RequiredVersion $_.Version -Force -Confirm:$false -WhatIf

                              }

                          }

                          1 person found this helpful
                          • 10. Re: Open-VMConsoleWindow Authorize Exception
                            MBreidenbach0 Hot Shot

                            Actually I searched for old module cleanup some days earlier and already found this here but didn't run cleanup on all systems

                            • 11. Re: Open-VMConsoleWindow Authorize Exception
                              mkfm Novice

                              I opened a support case for this and got this update: The problem will be fixed in v11.2. At the moment they're working on releasing 11.1, so we'll have to wait a bit.