I am trying to get the Powershell plugin to work in VM Orchestrator. I am pretty new to this and this is completely a test lab situation. I have the Plug successfully installed and the Powershell host has been successfully added. The powershell script that I am trying to run is a simple script that just renames a VM. The script runs fine from powershell but when I run it from the VCO, I get the follwoing:
[2014-04-18 13:21:00.992] [D] Invoke command in session aa481839-7cfe-42ce-8a73-71e6344128c6
[2014-04-18 13:21:22.918] [I] PowerShellInvocationError: Errors found while executing script
VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.ViServerConnectionException: 4/18/2014 1:21:21 PM Get-VM You are not currently connected to any servers. Please connect first using a Connect cmdlet.
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.MessageHelper.ThrowNotConnectedError()
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ConnectionDispatchHelper.DispatchObjectsHelper(IList`1 connectionList, IList`1 moListFromCmdletParameter, Dictionary`2 runlist, Dictionary`2 connectionIdToUidBourneIdList, Boolean isConnectionListExplicit)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ConnectionDispatchHelper.DispatchObjects(ParallelConnectionExecutor executor, UidDispatchHelper uidDispatchHelper, IList`1 connectionList, Boolean isConnectionListExplicit, IList`1 moListFromCmdletParameter, String moListFromCmdletParameterName, Boolean isServerParameterObnOnly)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()
at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()
Connect-VIServer : 4/18/2014 1:21:21 PM Connect-VIServer Exception
of type 'System.OutOfMemoryException' was thrown.
At C:\scripts\RenameVM.ps1:5 char:1
+ Connect-VIServer 'VC55-1' -username $username -password $password -force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViError
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Excep
tion,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
The script is as follows:
param ($OldName,$NewName)
add-pssnapin Vmware.VimAutomation.Core
$username='vc55-1\VMSrvAct'
Connect-VIServer'VC55-1'-username$username-password$password-force
$CurrentName=get-vm$OldName
set-vm-vm$CurrentName-Name$NewName-Confirm:$false
Disconnect-VIServer'vc55-1'-confirm:$false
The Environment consists of 3 servers.
1) A VM 5.5 Host
2) A W2008R2 5.5 Virtual Center
3) A w@008R2w@008R2 5.5 Orchestrator server with Powershell Plugin 1.0.3
It looks like it is failing onf the Connect-VIServer but this works when I run it by itself. Any help would be greatly appreciated.