Ranger275
Contributor
Contributor

PowerCLI 4.1 Opens and Closes on 2008 R2 Server

I have read the communities for years and normally find the answer to all my ills here. Unfortunately I cannot find an answer and even the mighty Google doesn't seem to help. Here goes my first post...

I have a VM I work from. I call it my toolbox. I load all my programs, tools, and settings to it. No matter where I go, I can RDP to it and get to work fast. I recently spun up a 2008 R2 VM and loaded vSphere PowerCLI 4.1. When it launches, it opens and quickly closes. I have tried running the commands that are found in the PowerCLI shortcut from a PowerShell 2.0 prompt to no avail. I can run commands in PowerGUI Script Editor and that works like a champ. The supported OS doc says Server 2008 is supported, but there is no mention of 2008 R2. Windows 7 is supported so I just figured that 2008 R2 would be OK. I can't find a smoking gun in the Event logs. I also tried installing in compatibility mode. No luck.

Any ideas?

Thanks for your help,

Sean

Tags (2)
23 Replies
LucD
Leadership
Leadership

Can you load the PowerCLI snapin from the PS v2 prompt ?

Add-PSSnapin VMware.VimAutomation.Core

I suppose so since PowerGui works.

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
Ranger275
Contributor
Contributor

It looks like it loads. I am still unable to launch from the PowerCLI shortcut.

Windows PowerShell
+ Copyright (C) 2009 Microsoft Corporation. All rights reserved.+
+ PS H:\> add-pssnapin vmware.vimautomation.core+
+ PS H:\>+

0 Kudos
LucD
Leadership
Leadership

Did you try executing the Initialize-VIToolkitEnvironment.ps1 script (in the Scripts directory) from the PS v2 prompt (after you loaded the snapin) ?

Perhaps the

[void][http://Reflection.Assembly|http://Reflection.Assembly]::LoadWithPartialName("VMware.Vim")

is causing the problem.

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
Ranger275
Contributor
Contributor

Looks like we are getting somewhere.

PS D:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\scripts> initialize-vitoolkitenvironment.ps1

The term 'initialize-vitoolkitenvironment.ps1' is not recognized as the name of a cmdlet, function, script file, or ope

rable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again

.

At line:1 char:36

+ initialize-vitoolkitenvironment.ps1 <<<<

+ CategoryInfo : ObjectNotFound: (initialize-vitoolkitenvironment.ps1:String) [], CommandNotFoundExceptio

n

+ FullyQualifiedErrorId : CommandNotFoundException

Suggestion : The command initialize-vitoolkitenvironment.ps1 was not found, but does exist in the current loc

ation. Windows PowerShell doesn't load commands from the current location by default. If you trust this command, instead

type ".\initialize-vitoolkitenvironment.ps1". See "get-help about_Command_Precedence" for more details.

PS D:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\scripts> .\initialize-vitoolkitenvironment.ps1

Welcome to the VMware vSphere PowerCLI!

Log in to a vCenter Server or ESX host: Connect-VIServer

To find out what commands are available, type: Get-VICommand

To show searchable help for all PowerCLI commands: Get-PowerCLIHelp

Once you've connected, display all virtual machines: Get-VM

If you need more help, visit the PowerCLI community: Get-PowerCLICommunity

Copyright (C) 1998-2010 VMware, Inc. All rights reserved.

PS D:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\scripts>

0 Kudos
admin
Immortal
Immortal

Hi Sean,

Can you try something which may help us to understand the reason for that problem?

1. Choose properties on PowerCLI shortcut and copy the value from Target field on Shortcut page.

2. Start cmd.exe

3. Paste the command and run it

4. Show us the error that you see (if there's a error)

There should be two PowerCLI shortcuts on your desktop (PowerCLI and PowerCLI 32 bit).

Did you try to run both? Do both of them open and close?

Thanks,

Vitali

PowerCLI team

0 Kudos
LucD
Leadership
Leadership

Isn't this due to the security policy ?

That script is a signed script, did you do a

Set-SecurityPolicy RemoteSigned

____________

Blog: LucD notes

Twitter: lucd22


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

Ranger275
Contributor
Contributor

Vitali,

Here you go and yes they both open and close. I also spun up another 2008 R2 VM and only installed PowerCLI 4.1 and got the same result. Thank you for the help.

VMware vSphere PowerCLI Shortcut

C:\Windows\system32>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -psc "D:\Program Files

(x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe -c ". \"D:\Program Files (x86)\VMware\I

nfrastructure\vSphere PowerCLI\Scripts\Initialize-VIToolkitEnvironment.ps1\""

Internal Windows PowerShell error. COM initialization failed while reading Windows PowerShell conso

le file with error 80010106.

VMware vSphere PowerCLI (32-Bit) Shortcut

C:\Windows\system32>C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -psc "D:\Program Files

(x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe -c ". \"D:\Program Files (x86)\VMware\I

nfrastructure\vSphere PowerCLI\Scripts\Initialize-VIToolkitEnvironment.ps1\""

Internal Windows PowerShell error. COM initialization failed while reading Windows PowerShell conso

le file with error 80010106.

0 Kudos
Ranger275
Contributor
Contributor

LucD - Do you mean set-executionpolicy remotesigned?

0 Kudos
LucD
Leadership
Leadership

Yes, sorry for the typo

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
admin
Immortal
Immortal

Hi Sean,

It is possible this problem to be related in some way with the VIX component on which PowerCLI depends. Can you confirm that you have the latest version of it 1.10?

To check that , go to the VIX installation folder and see the version of VixCom.dll (properties of the file). The installation folder should be %Program Files%\Vmware\Vmware VIX\

The official page of VIX component is:

http://www.vmware.com/support/developer/vix-api/

Vitali

0 Kudos
Ranger275
Contributor
Contributor

Here are the properties.

0 Kudos
admin
Immortal
Immortal

Hi again,

Your version of VIX is correct.

I'm still unable to reproduce the situation on windows 2008 R2 server.

1. Can you try to run the shortcut as administrator?

or

2. Uninstall the VIX component and install it again

Vitali

Ranger275
Contributor
Contributor

Run as Administrator was no luck.

Add/Remove Programs had VMware VIX version at 1.10.0.12331. I found a new version on VMware.com.

I installed VMware VIX version 1.10.1.12915. Still no luck trying to launch PowerCLI.

0 Kudos
nnedev
VMware Employee
VMware Employee

Hi,

I have some thoughts on the problem. Here are the areas that we should investigate:

1. PowerCLI snapin - already checked. You are able to load our snapin in PS console 2. Initilize-VIToolkitEnvironment script - already checked. You running the scripts with no erros.

3. PowerCLI console file - Go to PowerCLI installation folder and doubleclick on the vim.psc1 file. Verify that a new powershell popup window appears and PowerCLI snapin is loaded 4. PowerCLI shortcut - send us the shortcut file (VMware vSphere PowerCLI.lnk)

Regards,

Nedko Nedev

PowerCLI Development Team

Regards, Nedko Nedev PowerCLI Development Team
0 Kudos
Ranger275
Contributor
Contributor

3. PowerCLI console file - Go to PowerCLI installation folder and

doubleclick on the vim.psc1 file. Verify that a new powershell popup

window appears and PowerCLI snapin is loaded

I had this file associated with PowerGui Script Editor. I changed it to PowerShell and double clicked. A command window appeared and vanished.

4. PowerCLI shortcut - send us the shortcut file (VMware vSphere PowerCLI.lnk)

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -psc "D:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe -c ". \"D:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-VIToolkitEnvironment.ps1\""

0 Kudos
vmware34
Contributor
Contributor

removed

0 Kudos
Ranger275
Contributor
Contributor

Thank you to everyone for your help. I rebuilt another box from scratch and don't have any issues. Something happened along the way and it was easier to rebuild than continue trying to troubleshoot.

Thanks again,

Sean

0 Kudos
nnedev
VMware Employee
VMware Employee

I'm posting the fix in case someone has the same issue:

The problem was in your console file. You need to generate it again with the following steps:

1. Open powershell console and add PowrCLI snapin

2. Use the Export-Console cmdlet to generate a console file containing loaded snapins

3. Replace the file <PowerCLI install dir>\vim.psc1 with the newly created console file

This will solve the issue.

Regards,

Nedko Nedev

PowerCLI Development Team

Regards, Nedko Nedev PowerCLI Development Team
0 Kudos
hayb
Contributor
Contributor

I had the same problem.

I have attempted the solution Nedko / nnedev offered. It has not worked.

Any more ideas would be of help, i am determined to get PowerCLI working :smileygrin:

0 Kudos