Anyone try using vi powershell cmdlets with Poshboard?

Aug 29, 2008 at 4:29 PM
I have tried adding the "Add-Pssnapin VMware.VimAutomation.Core" to profile.ps1 in "%windir%\system32\WindowsPowerShell\v1.0\" but still not working. Any ideas?
Coordinator
Aug 29, 2008 at 5:26 PM
Edited Aug 29, 2008 at 6:35 PM
Hi,

there's no problem using any snapin with Poshboard. But since we use .net to generate a powershell runspace, the portal don't use the profile.ps1 : the solution is to simply add your snapin directly in the script in the widget :

So just add this on top of your script :

Add-Pssnapin VMware.VimAutomation.Core

and here you go !

Today all widget got it's specific runspace, I'm working on a central script manager that will ease the use of snapin across multiple widget.

hope this helps,

antoine

Dec 31, 2008 at 5:34 AM

I am also receiving an error when attempting this even though the Add-PSSnapin is inside the widget.  The error occurs when it attempts the Get-VC alias .... "Sys.WebForms.PageRequestManagerServerErrorExceptoin: exePath must be specified when not running inside a stand alone exe.

Add-PSSnapin VMware.VimAutomation.Core
set-alias Get-VC Connect-VIServer
set-alias Get-ESX Connect-VIServer

function Get-VICommand() {
  get-command -pssnapin VMware.VimAutomation.Core,VIPowerShellCommandsSnapin
}
$VCList = "VC1", "VC2", "VC3", "VC4"
foreach ($VC in $VCList){
$Collection = @()
Get-VC $VC | out-null
$VMList = Get-VM
$VMList | foreach {
$Custom1 = "" | Select Name, PowerState, Description
  $Custom1.Name = $_.name
  $Custom1.PowerState = $_.powerstate
  $Custom1.Description = $_.description
$Collection += $Custom1
}
}
$Collection | select-object | Sort Name | format-grid –p Name,PowerState,Description

Coordinator
Dec 31, 2008 at 7:31 AM

I haven't tested this snapin.

Did this script works "as is" in the powershell console on your poshboard server ?
Dec 31, 2008 at 7:49 AM
Yes, it works from the Powershell Console.  I am also able to run the Add-PSSnapin for VI and I am able to list the Get-VICommand function to pull the cmdlets successfully.  It just appears to error out when connecting to the Host or VirtualCenter.
Coordinator
Dec 31, 2008 at 8:15 AM
Did you try to publish the website ? it may be an error due to Debug Mode isolation.

Try to build the website in release mode and put it in your IIS then try again.
Dec 31, 2008 at 8:21 AM
Yes, this is in the published web site.  The site is published in IIS 7.0 on Vista.  The database is attached to a SQL Instance running on Server 2008.  I was having problems publishing the site there, but I'll work through that later.
Coordinator
Dec 31, 2008 at 9:39 AM
Hi,

it seems to be a general problem with this snapin :



Mar 24, 2010 at 7:56 PM

Any update on this?  Has anyone been able to get the "Connect-ViServer" cmdlet to work with PoShboard?