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
Windows 10 1803
PS C:\PowerCLI\_> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 17134 228
PS C:\PowerCLI\_> Get-PowerCLIModules
that function has definitely saved my day! :smileygrin:
Obviously, many thanks to LucD as well
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.
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
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?
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?
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?
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.
My bad, the code snippet was from an old PowerCLI project and does not handle future version checking.
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.
@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?
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?