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
apolonie
Enthusiast
Enthusiast

Unfortunately same error with powershell v7.1.2, see attached picture. Any other ideas?

0 Kudos
LucD
Leadership
Leadership

One thing you could try is to install PowerCLI 10.2.
The cmdlet worked in that version.
Curious to see if that works in your environment


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

apolonie
Enthusiast
Enthusiast

Okay removing everything and will try PowerCLI 10.2 with VMRC 12. Will test on both PS v5 and v7. 

0 Kudos
LucD
Leadership
Leadership

Don't bother with PSv7, that PowerCLI version only works with PSV5


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

apolonie
Enthusiast
Enthusiast

Same error, but oddly enough if I run the Get-PowerCLIVersion cmdlet it returns that I'm running PowerCLI 12.2.0 even after wiping 12.2.0 and installing 10.2.0. I confirmed that there were no files in my Documents\WindowsPowershell\Modules as well as \System32\Program Files\WindowsPowershell\Modules folder relating to VMware. Is there something I'm missing?

0 Kudos
LucD
Leadership
Leadership

What does Get-Module -Name VMware* -ListAvailable return?


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

apolonie
Enthusiast
Enthusiast

Here is attached cmdlet output. 

0 Kudos
LucD
Leadership
Leadership

You are still running PowerCLI 12.2
Delete those folders manually, then install 10.2 from the ZIP file.
Do not forget to unlock the ZIP file.


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

apolonie
Enthusiast
Enthusiast

Attached image is powercli modules from 10.2 zip file. Unfortunately when trying to connect to vcenter server I receive error about the vmware.vimAutomation.core package.

0 Kudos
apolonie
Enthusiast
Enthusiast

Attached is error when importing vmware.vimautomation.core package.

0 Kudos
LucD
Leadership
Leadership

What do you have in $env:PSModulePath?


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

apolonie
Enthusiast
Enthusiast

Apologies I'm making things so difficult, here is attached picture of env path. Also attempted moving the module folders to my user/Documents/WindowsPowershell/Modules folder with same error.

0 Kudos
LucD
Leadership
Leadership

Did you unlock the ZIP (Unblock-File) file after you downloaded it?


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

apolonie
Enthusiast
Enthusiast

I extracted the files and "unzipped" it if that's what you're referring to. Also, where should the folders optimally be? I was reading one of your other threads: https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Having-issues-with-offline-installatio... where you suggested that the files should ultimately be within the personal user\documents\windowspowershell folder instead of the Program Files\Windows Powershell folder.

 

Also, would my personal folder being in a network drive have any affect on powercli? 

0 Kudos
LucD
Leadership
Leadership

No, you also have to unlock a file you downloaded.
See Solved: Installing PowerCLI - VMware Technology Network VMTN

Older versions of PS had issues with modules on network drives.
Not 100% sure if that still could have an impact.
To avoid that, install the modules in C:\Program Files\WindowsPowerShell\Modules


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

apolonie
Enthusiast
Enthusiast

Wow! The command:  Get-ChildItem -Path "C:\Program Files\WindowsPowerShell\Modules\VMware*" -Recurse | Unblock-File worked to unblock the files and I can now connect seamlessly.

To anybody else having the issue: this is what worked for me.

Powershell version: 5.7

PowerCLI version: 10.2

VMRC version: 12

PowerCLI modules downloaded in: "C:\Program Files\WindowsPowerShell\Modules" must be unblocked using Get-ChildItem command.

 

Major, major kudos to you @LucD, certainly wouldn't have been able to have done it on my own. Much thanks to you!

0 Kudos
LucD
Leadership
Leadership

Ok, but you are using an older PowerCLI version.
The problem with 12.2 is still there?
Or did you also install that from a ZIP file?


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

0 Kudos
apolonie
Enthusiast
Enthusiast

When I installed 12.2 I used the Install-Module cmdlet to install, do you need to use the unblock-file command on those folders as well? I will attempt upgrade tomorrow and update you with details.

0 Kudos
LucD
Leadership
Leadership

No, not in that case


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

0 Kudos