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

78 Replies
Borja_Mari
Virtuoso
Virtuoso

Dear dmcdonough​,

that function has definitely saved my day! :smileygrin:

Many thanks!!

Obviously, many thanks to LucD​ as well Smiley Happy

Best regards,

Pablo

------------------------------------------------------------------------------------------------- PLEASE CONSIDER AWARDING any HELPFUL or CORRECT reply. Thanks!! Por favor CONSIDERA PREMIAR cualquier respuesta ÚTIL o CORRECTA . ¡¡Muchas gracias!! VCP3, VCP4, VCP5-DCV (VCP550), vExpert 2010, 2014 BLOG: http://communities.vmware.com/blogs/VirtuallyAnITNoob
0 Kudos
apolonie
Enthusiast
Enthusiast

Hi guys, 

 

Any update on this issue? I have recently upgraded to vsphere 6.7 and I now run in to the issue described here. never had the issue with vsphere 6.0. 

0 Kudos
LucD
Leadership
Leadership

That was fixed in PowerCLI 12.0


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

apolonie
Enthusiast
Enthusiast

Hi LucD,

I seem to have PowerCLI 12.2 installed, could you see from my dependency versions what my other issue may be? Unfortuantely I'm quite new to vSphere and attempting to learn as I go!

0 Kudos
LucD
Leadership
Leadership

That error seems to say that you are not connected to a vSphere server.
Did you do a Connect-VIServer first?
The error in fact states that the Get-VM didn't work due to that reason.


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

apolonie
Enthusiast
Enthusiast

Yes, sorry I must have forgot to reconnect. Attached is image with relevant error.

0 Kudos
LucD
Leadership
Leadership

I just noticed on your first screenshot that you still seem to have modules from PowerCLI 6.5 installed.
Did you remove that version via Programs and Features?
That is an MSI install.

Best would be to remove all PowerCLI related files and folders (after the MSI uninstall), and start fresh with Install-Module.


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

apolonie
Enthusiast
Enthusiast

Sounds good thank you. Just to confirm, are all PowerCLI related folders under "C:\Program Files\WindowsPowerShell\Modules" with any VMWare.* folder? 

0 Kudos
LucD
Leadership
Leadership

That depends on which Scope you specify on Install-Module.
With Scope AllUsers the modules go to C:\Program Files\WindowsPowerShell\Modules,
with Scope CurrentUser they go to your personal Documents folder under Documents\WindowsPowerShell\Modules


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

DCasota
Hot Shot
Hot Shot

 

Spoiler
Hi @apolonie,

I can remember that there were prerequisites for PowerCLI 6.5.x.: #1 uninstall older PowerCLI builds #2 Uninstall VMware Remote Console # Uninstall VMware VIX. Just found the article https://blogs.vmware.com/PowerCLI/2017/08/updating-powercli-powershell-gallery.html, see the comment entry of MacKopes 10th of August 2017.

In Windows check the following Powershell folder locations. All of them could contain older PowerCLI builds.
%ProgramFiles%\WindowsPowerShell\Modules
%Windir%\System32\WindowsPowerShell\v1.0\Modules
%UserProfile%\Documents\WindowsPowerShell\Modules
%ProgramFiles%\WindowsPowerShell\Modules


You may detect and cleanup VMware Remote Console and VMware VIX installations with the following snippet.

$installed = Get-WmiObject -Class Win32_Product -Filter "name like '%VMware%'"
$PowerCLI = $installed | ? Name -eq 'VMware vSphere PowerCLI' | Select-Object -ExpandProperty IdentifyingNumber -First 1
$VMRC = $installed | ? Name -eq 'VMware Remote Console' | Select-Object -ExpandProperty IdentifyingNumber -First 1
$VIX = $installed | ? Name -eq 'VMware VIX' | Select-Object -ExpandProperty IdentifyingNumber -First 1
if ($PowerCLI)
{
# Uninstall older PowerCLI build
Start-Process -FilePath MsiExec.exe -ArgumentList "/uninstall $PowerCLI /qb!" -Wait
}
if ($VMRC)
{
# Uninstall VMware Remote Console
Start-Process -FilePath MsiExec.exe -ArgumentList "/uninstall $VMRC /qb!" -Wait
}
if ($VIX)
{
Uninstall VMware VIX
Start-Process -FilePath MsiExec.exe -ArgumentList "/uninstall $VIX /qb!" -Wait
}

In addition, at that time unfortunately there were somewhat of culprits with required Powershell modules powershellget&packagemanagement and package provider nuget highly depending on Windows os release and patch level. So it wasn't possible to make a 'one for all silver bullet' cleanup respecting all side effects.

Hope this helps. Daniel

 

apolonie
Enthusiast
Enthusiast

Okay, I am doing this as an admin so I have confirmed that there are no VMWare.* files in my C:\Program Files\WindowsPowerShell\Modules folder. Also confirmed that there are no modules in my  Documents\WindowsPowerShell\Modules directory as well. 

This was done using the following command: (Get-Module VMware.PowerCLI -ListAvailable).RequiredModules | Uninstall-Module -Force

Then went with fresh install of PowerCLI using: Install-Module VMware.PowerCLI -Scope AllUsers

Also did it for current scope: Install-Module VMware.PowerCLI -Scope CurrentUser

Proceeded to connect to vcenter server and used "Open-VMConsoleWindow" and still came to same error. 

What are the commands to see the version of PowerCLI and it's dependencies to confirm I have all right versions?

0 Kudos
apolonie
Enthusiast
Enthusiast

Hi @DCasota , I remember I haven't uninstalled VMRC! I will give that a try thanks for the advice.

0 Kudos
LucD
Leadership
Leadership

Does Get-Module -Name VMware* -ListAvailable still show the old 6.5 modules?
Is there a PowerCLI entry under Programs and Features in the Control Panel?


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

apolonie
Enthusiast
Enthusiast

I don't believe so. See attached picture, some are v 7.x or 1.x but I believe they came with fresh install. Still come to same problem even after uninstalling VMRC and running @DCasota  snippet. Should there be another PowerCLI under programs and features or was that a legacy feature?

0 Kudos
LucD
Leadership
Leadership

No, those are the version that came with PowerCLI 12.2.

Just to make sure, you did stop/start your PowerShell session after the removal and the fresh install of 12.2?

On another note, did you try the bypass snippet I posted earlier in this thread?
Does that work?


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

apolonie
Enthusiast
Enthusiast

Apologies but to be painfully clear: I did stop/start after the removal and fresh install, i.e. I removed, fresh installed, closed instance of powershell, started new powershell instance, then tried to open-VMconsole window. Is that what you mean? Or should I have started a new instance after removal / before fresh install?

Unfortunately I haven't tried your method. I am doing research for a university that utilizes the Open-VMConsoleWindow command and I am unable to change it and need to utilize that command as of right now. If there isn't another option, I may be able to utilize your workaround.

0 Kudos
LucD
Leadership
Leadership

As another option, did you try the same from a PSv7 session?
You can install PSv5.1 and PSv7 side-by-side on a Windows box.


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

DCasota
Hot Shot
Hot Shot

My bad, the code snippet was from an old PowerCLI project and does not handle future version checking.

Prerequisites of PowerCLI 12.2 with VMRC Release 12 : On the same Windows machine: .NET framework 4.7.2 or later, and Windows Powershell 5.1

In order for the Open-VMConsoleWindow cmdlet to work on all OS types VMware Remote Console (VMRC) also needs to be installed.

Just spottted many good advices earlier in this post. If the workaround @LucD mentioned earlier in this post doesn't work, the migration&cleanup of the chain dependency of WindowsPatches-PowershellModules-PowerCLI might not be finished.

 

apolonie
Enthusiast
Enthusiast

@LucD No I haven't tried any other version of powershell but will experiment with that today and will let you know if that works. @DCasota thanks for the catch I will reinstall VMRC again and see if that also makes a change.

 

The only other dependencies required for PowerCLI Open-VMConsoleWindow PowerCLI 12.2 Module and VMRC module correct?

0 Kudos
apolonie
Enthusiast
Enthusiast

I reconfigured VMRC 12, with Powershell 5.1 and powerCLI 12.2 and still reach same error. Will attempt with different versions of powershell now.

I have also taken a look at the VMWare PowerCLI User Guide and I don't see any reference to a Open-VMConsoleWindow command. Is the command depreciated? 

https://vdc-download.vmware.com/vmwb-repository/dcr-public/adea0282-67ca-4678-8d0d-95d266f6c336/2c07...

 

0 Kudos