MBreidenbach0
Hot Shot
Hot Shot

Open-VMConsoleWindow Authorize Exception

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

82 Replies
jbaumgartnerTC
Contributor
Contributor

I added a little bit to LucD's code to make a full function that acts more like a full drop-in replacement for Open-VMConsoleWindow.

function Open-VMConsole {

  #requires -Module VMware.VimAutomation.Core


  Param(

    [Parameter(ParameterSetName = 'PassByVMObject',

      Mandatory = $true,

      ValueFromPipeline = $true)]

    [ValidateNotNullOrEmpty()]

    [VMware.VimAutomation.ViCore.Impl.V1.VM.UniversalVirtualMachineImpl[]]$VM,


    [Parameter(ParameterSetName = 'PassByVMName',

      Mandatory = $true,

      ValueFromPipeline = $true)]

    [ValidateNotNullOrEmpty()]

    [string[]]$VMName,


    [Parameter(Mandatory = $false)]

    [string]$VMRC = "C:\Program Files (x86)\VMware\VMware Remote Console\vmrc.exe"

  )


  begin {

    # Hold all the VMs we want to launch

    $VMs = @()

  }


  process {

    # Add all the VMs to the VM list - load the VM info if need be...

    if($PSCmdlet.ParameterSetName -eq 'PassByVMObject') {

      $VM | ForEach-Object { $VMs += $VM }

    } else {

      $VMName | ForEach-Object { $VMs += Get-VM $_ }

    }

  }


  end {

    $VMs | Foreach-Object {

      # Acquire MKS ticket

      $MKSTicket = $_.ExtensionData.AcquireMksTicket()


      # Build the URI

      $VMRC_URI = "vmrc://$($_.VMHost.Name):902/?mksticket=$($MKSTicket.Ticket)&thumbprint=$($MKSTicket.SslThumbPrint)&path=$($MKSTicket.CfgFile)"


      # Launch

      & "$VMRC" $VMRC_URI

    }

  }

}

LucD
Leadership
Leadership

Thanks for sharing.

Did you by any chance, also try Open-VmConsoleWindow with PowerCLI 11.3.0?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jbaumgartnerTC
Contributor
Contributor

Did you by any chance, also try Open-VmConsoleWindow with PowerCLI 11.3.0?

Yes, I was really hoping 11.3.0 would solve my issue.  I had it working properly with 11.2.0 prior to having my laptop reimaged.  I can't for the life of me remember what I had done to make it work.

0 Kudos
LucD
Leadership
Leadership

Do you perhaps have multiple PowerCLI versions installed?
That was a problem


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jbaumgartnerTC
Contributor
Contributor

Nope.  Fresh install of the OS, so nothing lingering.  Fresh install of 11.3.0.

I've tried setting my config to point at vmrc.exe and my browser (Firefox) and neither works, same error recurs.

0 Kudos
LucD
Leadership
Leadership

Did you set the PowerCli configuration InvalidCertificateAction to Ignore?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jbaumgartnerTC
Contributor
Contributor

Yes, it is.  I've gone through the other things in this thread and confirmed the configuration to the best of my ability.

I appreciate the help, though.  I wasn't really looking for more help to troubleshoot, I just wanted to share tweaks to the workaround that was provided.

LucD
Leadership
Leadership

Bummer!
But my earlier snippet which you turned into a function still works?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jbaumgartnerTC
Contributor
Contributor

Yes, it work's beautifully.  I just made it a full function, and made it accept pipeline input.  I was so used to running "Get-VM xxx | Open-VMConsoleWindow" that I wanted this to work the same.

0 Kudos
LucD
Leadership
Leadership

Good.
I'm afraid you will have to live with that function for now.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
TimHodkin
Contributor
Contributor

Im on 11.3 PowerCLI / Vsphere 6.7.0 13639324 and I'mm still seeing the issue.

The script posted does help, but annoying having to remember to drop it in profiles from the various servers.

Does anyone know what the actual problem is with the command?

I checked the Cert and indeed it does state that it cannot check the CRL so its therefore invalid.

I'll see if i can replace with an internal CA cert.

0 Kudos
mkfm
Enthusiast
Enthusiast

just updated to v11.3 and still "Open-VMConsoleWindow : A general system error occurred: Authorize Exception"

I opened a support request and pointed to my last SR where I was told that it will be resolved in 11.2.

(for vmware employees: SR 19009423006, old one 18956929110)

edit: just got a call. GSS told me it's on engineering's list, but low priority because there is a workaround. No info yet when it will be worked on, but a kb article (68186) is in the making and will be released soon.

dmcdonough
Contributor
Contributor

August 2019 and it's still happening. Here's a more robust version of LucD's script, it at least lets you pipe in VMs:

function Open-VMConsoleWindow2 {

    [cmdletbinding()]

    param(

        [parameter(ValueFromPipeline)]

        [VMware.VimAutomation.ViCore.Impl.V1.VM.UniversalVirtualMachineImpl[]]$vm

    )

    begin {

        $vmrcUri = 'vmrc://{0}:902/?mksticket={1}&thumbprint={2}&path={3}'

    }

    process {

        foreach ($a_vm in $vm) {

            $mks = $a_vm.ExtensionData.AcquireMksTicket()

            Write-Verbose "Opening Uri '$vmrcUri'"

            Start-Process ($vmrcUri -f $a_vm.VMHost.Name, $mks.Ticket, $mks.SslThumbPrint, $mks.CfgFile)

        }

    }

}

Also, the get-module part doesn't seem necessary if you have VMRC installed correctly, so I dropped it (it had issues if you had multiple versions of PowerShell installed anyway).

GordonPM
Enthusiast
Enthusiast

So - now the above method doesn't work either, as VMware have removed VMRC from PowerCLI module as of Version 12 so you can no longer call vmrc.exe from the VMware.VimAutomation.Core component folder?

Is there any way around this without installing VMRC or are we back to that dependency now?

LucD

0 Kudos
LucD
Leadership
Leadership

I think the Help page for the Open-VMConsoleWindow is clear.

It says "This cmdlet assumes that either VMware Remote Console, VMware Workstation or VMware Fusion is installed."


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
GordonPM
Enthusiast
Enthusiast

Yes I;ve seen it thanks, just seems a odd that there's no method to launch a console just using Powershell without any dependencies...

0 Kudos
LucD
Leadership
Leadership

The basic issue might be that PowerCLI is multi-platform.
On the positive side, VMRC is available for Windows, Linux and MacOS


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
esxi1979
Expert
Expert

Hi

I just upgraded vcenter from 6.0 to vcsa 6.7

i get error

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

At line:1 char:23

I tried the function does not work for me

However, if I log into the vCenter server locally, and use a local Windows account in vSphere web client , then try connect vm , i get warning for cert but i can connect - it works OK.

I am using

PowerCLI Version

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

   VMware PowerCLI 12.0.0 build 15947286

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

Component Versions

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

   VMware Common PowerCLI Component 12.0 build 15939652

   VMware Cis Core PowerCLI Component PowerCLI Component 12.0 build 15939657

   VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 12.0 build 15939655

==

Major  Minor  Build  Revision

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

5      1      18362  752

==

also have Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Please suggest

0 Kudos
LucD
Leadership
Leadership

Did you use the same account for the Connect-VIServer cmdlet and for logging into the Web Client?
What error does the function return?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

esxi1979
Expert
Expert

Again the error i got with other user as well

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

At line:1 char:22

+ get-xxxxx |Open-VMConsoleWindow

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

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

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

===

I was able to fix this with below change of path ! somehow vmrc.exe did not in the path in my case....

$vmName = 'xxxxx'

$moduleName = 'VMware.VimAutomation.Core'

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

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

$vmrcPath = "C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation.Core\11.5.0.14899560\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

0 Kudos