VMware Horizon Community
Avial
Contributor
Contributor
Jump to solution

Unable to launch View PowerCLI on View 4.5

Hello,

I got two server running on View 4.5.
I need to use the view cmdlet but each time i'm trying to launch the VMware View PowerCLI, i got the same error on both server.

Add-PSSnapin : The Windows PowerShell snap-in 'VMware.View.Broker' is not installed on this machine.

At D:\apps\VMware\VMware View\Server\extras\PowerShell\add-snapin.ps1:30 char:14
+     add-PSSnapin <<<<  $view_snapin_name
    + CategoryInfo          : InvalidArgument: (VMware.View.Broker:String) [Add-PSSnapin], PSArgumentException
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

I've try to manually install it.

In the view 45 integration guide : The script configuration file for the View PowerCLI cmdlets is named InitViewCmdlets.ps1.

I can't find this script.

Done multiple reinstallation.

If anyone have an idea

Tags (3)
Reply
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

Ok, it looks as if the script is choosing the 32-bit InstallUtil rather than the 64-bit.

Can you try running the following command to install the snapin?

C:\WINNT\Microsoft.NET\Framework64\v2.0.50727\installUtil <View Path>\bin\PowershellServiceCmdlets.dll

Where <View Path> is where you installed your Connection Server.


If this works, running the script should work as it won't be trying to install the snapin again, and will just load it using Add-PSSnapin.

View solution in original post

Reply
0 Kudos
20 Replies
LucD
Leadership
Leadership
Jump to solution

Don't you have the Extras folder in the View installation folder ?


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

Reply
0 Kudos
Avial
Contributor
Contributor
Jump to solution

Yes ,

Inside this folder, i have 5 more folders with the one "powershell"

Inside powershell the 2 script : add-snapin.ps1 and uninstall-snapin.ps1.

But i can't find the InitViewCmdlets.ps1.

Reply
0 Kudos
Avial
Contributor
Contributor
Jump to solution

Any idea ?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Thread moved to the View Community.


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

Reply
0 Kudos
Avial
Contributor
Contributor
Jump to solution

After installing a 2008R2 (Before i was on 2003) server and installing the same View 4.5

Got the snap-in installed correctly.

Don't know where the error was ...

Reply
0 Kudos
npeter
Expert
Expert
Jump to solution

you have to have powershell feature in your windows machine. by default windows 2003 doesn't have powershell installed. but win2008 by default has this feature.

-noble

-nObLe
Reply
0 Kudos
Avial
Contributor
Contributor
Jump to solution

Yes, i know that.

I have try with Powershell v1 and v2 and i was always getting the same error.

Reply
0 Kudos
towlesd
Contributor
Contributor
Jump to solution

Ran into the same issue today and narrowed it down to the fact that "Add-PSSnapin VMware.View.Broker" only works on the primary Connection Server.

Running it from my replica server returns the same error that VMware.View.Broker is not installed.

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Sorry to hear you've been having trouble, got a few questions that might narrow the problem down:

What OSs are your main broker and replica servers running on? Are they 32/64 bit?

Have you installed to the default directory?

Reply
0 Kudos
Avial
Contributor
Contributor
Jump to solution

Hello

The main server is a Windows 2003 R2 64bits and the replica is a 2008R2.

The file aren't installed to the default directory ( > d:\soft\... )

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Not figured out what's going on yet, but I've not forgotten!

I've setup a replica on 2k8 R2 with a nonstandard install directory. That worked ok. Haven't tried somewhere other than the C: drive, which will take a little longer to set up.

If that still works, I'll look into where it might be falling over in the launch script.

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Ok, all working fine for me, but we can do something to get more info:

Can you edit the add-snapin.ps1 file (in extras\PowerShell under View's install dir) and replace this line:

$null = (installUtil ($installpath  + "\bin\PowershellServiceCmdlets.dll"))

with

(installUtil ($installpath  + "\bin\PowershellServiceCmdlets.dll"))

Removing the $null assignment will give us the output from the installUtil tool, which I believe is the most likely place this could be falling over.

Once you've made the change and re-run the script, if you post the output for me, I should be able to see what's going on a bit better.

Cheers,
Tom

Reply
0 Kudos
Avial
Contributor
Contributor
Jump to solution

The problem is on the main server which is a 2K3 x64 sp2, the replica 2008r2 is fully working.

by deleting the $null i'm getting this output.

PS D:\apps\VMware\VMware View\Server\extras\PowerShell> D:\apps\VMware\VMware View\Server\extras\PowerShell\add-snapin.ps1
Loading VMware View PowerCLI
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053
Copyright (c) Microsoft Corporation.  All rights reserved.
Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'PowershellServiceCmdlets, Version=4.5.0.3082, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format..
Add-PSSnapin : The Windows PowerShell snap-in 'VMware.View.Broker' is not installed on this machine.
At D:\apps\VMware\VMware View\Server\extras\PowerShell\add-snapin.ps1:30 char:14
+     add-PSSnapin <<<<  $view_snapin_name
    + CategoryInfo          : InvalidArgument: (VMware.View.Broker:String) [Add-PSSnapin], PSArgumentException
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
Reply
0 Kudos
Camek
Enthusiast
Enthusiast
Jump to solution

To get View PowerCLI to work for us...

1) We had to make sure it was running on a View Connection Broker Server

2) We had to run start Windows Power Shell  (we use the following batch command)

     cd %Systemroot%\system32\Windowspowershell\v1.0
     powershell c:\viewscripts\refreshpool.ps1

3) Then at the top of the PS1 script we need to have the following

    function LoadSnapin{
       Add-PSSnapin VMware.View.Broker -ErrorAction SilentlyContinue
     }

     LoadSnapin

After we did all three things as above the View PowerCLI works great.   What we have it do is each night for the selected Pools we have it find all the desktops in the pool and and do a linkedclonerefresh which make sure each desktop is clean and we don't have to take the hit on doing refreshes on logoff during the day....

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Thanks Camek, this will only work if you've successfully launched View PowerCLI once using add-snapin.ps1 (such as from the Start Menu), which will install the snapin so it can be added to a session as you've described. Alternatively, the snapin can be installed manually using the InstallUtil.


In the error listed in Avial's post, it looks as if the snapin cannot be installed at all.

Avial, I have a sneaking suspicion that the script is using the wrong version of InstallUtil. Can you add a line to the .ps1 file that will echo the value of the installUtil alias?

Get-Alias installUtil

Reply
0 Kudos
Camek
Enthusiast
Enthusiast
Jump to solution

I agree it should work that way but we never could get the install working on 2008R2 box so we dropped back to our current method.  Not a big deal for us as we only run batch scripts....

Reply
0 Kudos
Avial
Contributor
Contributor
Jump to solution

By adding the Get-alias i get this output

CommandType     Name                                                                                     Definition                                                                             
-----------                  ----                                                                                     ----------                                                                             
Alias                    installUtil                                                                              C:\WINNT\Microsoft.NET\Framework\v2.0.50727\installUtil     
Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Ok, it looks as if the script is choosing the 32-bit InstallUtil rather than the 64-bit.

Can you try running the following command to install the snapin?

C:\WINNT\Microsoft.NET\Framework64\v2.0.50727\installUtil <View Path>\bin\PowershellServiceCmdlets.dll

Where <View Path> is where you installed your Connection Server.


If this works, running the script should work as it won't be trying to install the snapin again, and will just load it using Add-PSSnapin.

Reply
0 Kudos
Avial
Contributor
Contributor
Jump to solution

Thank you Tom, this work fine Smiley Happy

Reply
0 Kudos