gazza_d
Contributor
Contributor

Issue loading powercli snapin via workflow module

Hi

So I am trying to get vRealize Orchestrator running., and am trying to get it to run powershell commands via  powershell host.

The powershell stuff works, and the demo "List directory content" workflow works fine.

I have a workflow that opens a session, then loads the VMware.VimAutomation.Core module via the addPSSnapin element.

when I do that I get the following error

PowerShellInvocationError: Errors found while executing script Add-PSSnapin : The Windows PowerShell snap-in 'VMware.VimAutomation.Core' is not installed on this computer. At line:1 char:1 + Add-PSSnapin -Name VMware.VimAutomation.Core + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (VMware.VimAutomation.Core:Stri ng) [Add-PSSnapin], PSArgumentException + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad dPSSnapinCommand (Dynamic Script Module name : invokeCommand#15)

the powershell host is running Powershell version

Name Value
---- -----
PSVersion 5.1.14409.1027
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1027
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

 

I have completely removed powercli and reinstalled it from the powershell gallery with Install-Module -Name VMware.PowerCLIScope Allusers and I can see it as below


PS C:\Windows\system32> get-installedmodule

Version Name Repository
------- ---- ----------
1.0.2 cUserRightsAssignment PSGallery
2.1.3.0 PoShKeePass PSGallery
12.6.0.... VMware.CloudServices PSGallery
7.0.3.1... VMware.DeployAutomation PSGallery
7.0.3.1... VMware.ImageBuilder PSGallery
12.7.0.... VMware.PowerCLI PSGallery
12.6.0.... VMware.PowerCLI.Sdk PSGallery
12.6.0.... VMware.PowerCLI.Sdk.Types PSGallery
12.6.0.... VMware.PowerCLI.VCenter PSGallery
12.6.0.... VMware.PowerCLI.VCenter.Types.Ap... PSGallery
12.6.0.... VMware.PowerCLI.VCenter.Types.Ce... PSGallery
4.0.0.2... VMware.Sdk.Nsx.Policy PSGallery
1.0.106... VMware.Sdk.Runtime PSGallery
1.0.104... VMware.Sdk.vSphere PSGallery
3.0.104... VMware.Sdk.vSphere.Appliance PSGallery
2.0.104... VMware.Sdk.vSphere.Appliance.Access PSGallery
1.0.104... VMware.Sdk.vSphere.Appliance.Health PSGallery
1.0.104... VMware.Sdk.vSphere.Appliance.Inf... PSGallery
1.0.104... VMware.Sdk.vSphere.Appliance.Loc... PSGallery
1.0.104... VMware.Sdk.vSphere.Appliance.Log... PSGallery
1.0.104... VMware.Sdk.vSphere.Appliance.Net... PSGallery
1.0.104... VMware.Sdk.vSphere.Appliance.Rec... PSGallery
1.0.104... VMware.Sdk.vSphere.Appliance.Sup... PSGallery
1.0.104... VMware.Sdk.vSphere.Appliance.System PSGallery
1.0.104... VMware.Sdk.vSphere.Appliance.Update PSGallery
1.0.104... VMware.Sdk.vSphere.Cis PSGallery
1.0.104... VMware.Sdk.vSphere.Cis.Tagging PSGallery
1.0.104... VMware.Sdk.vSphere.Content PSGallery
1.0.104... VMware.Sdk.vSphere.ContentLibrary PSGallery
1.0.104... VMware.Sdk.vSphere.Esx.Hcl PSGallery
1.0.104... VMware.Sdk.vSphere.Esx.Hosts PSGallery
1.0.104... VMware.Sdk.vSphere.Esx.Settings PSGallery
1.0.104... VMware.Sdk.vSphere.VAPI.Metadata PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Authe... PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.CertM... PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Content PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Datas... PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Deplo... PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Guest PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Identity PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Inven... PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.ISO PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.LCM PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Names... PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Names... PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.OVF PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Services PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Storage PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Syste... PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Tagging PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Topology PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Trust... PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.VCHA PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.Vm PSGallery
1.0.104... VMware.Sdk.vSphere.vCenter.VmTem... PSGallery
1.0.104... VMware.Sdk.vSphere.vStats PSGallery
1.0.104... VMware.Sdk.vSphereRuntime PSGallery
7.0.3.1... VMware.Vim PSGallery
12.6.0.... VMware.VimAutomation.Cis.Core PSGallery
12.0.0.... VMware.VimAutomation.Cloud PSGallery
12.7.0.... VMware.VimAutomation.Common PSGallery
12.7.0.... VMware.VimAutomation.Core PSGallery
12.7.0.... VMware.VimAutomation.Hcx PSGallery
12.7.0.... VMware.VimAutomation.HorizonView PSGallery
12.0.0.... VMware.VimAutomation.License PSGallery
12.5.0.... VMware.VimAutomation.Nsxt PSGallery
12.7.0.... VMware.VimAutomation.Sdk PSGallery
12.3.0.... VMware.VimAutomation.Security PSGallery
12.7.0.... VMware.VimAutomation.Srm PSGallery
12.7.0.... VMware.VimAutomation.Storage PSGallery
1.6.0.0 VMware.VimAutomation.StorageUtility PSGallery
12.7.0.... VMware.VimAutomation.Vds PSGallery
12.7.0.... VMware.VimAutomation.Vmc PSGallery
12.5.0.... VMware.VimAutomation.vROps PSGallery
12.4.0.... VMware.VimAutomation.WorkloadMan... PSGallery
12.7.0.... VMware.VumAutomation PSGallery
3.2.0 xWebAdministration PSGallery
2.0.0.2 xXMLConfigFile PSGallery

When I add it manually it works fine.

Does anyone have any ideas what the issue is? 

Thanks

Gary

 

 

 

0 Kudos
1 Reply
gazza_d
Contributor
Contributor

I have been trying to troubleshoot this issue with no success.

If I run a powershell command to list the installed modules, I can see all the powercli ones.

But the action element to add the pssnapin still fails with not installed.

2022-08-04 14:12:14.726 +01:00INFO__item_stack:/item4
2022-08-04 14:12:31.995 +01:00INFOWARNING: MSG:UnableToDownload
https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409� ��
WARNING: Unable to download the list of available providers. Check your
internet connection.

Version Name Repository Description
------- ---- ---------- -----------
1.0.2 cUserRightsAssignment PSGallery The cUse...
2.1.3.0 PoShKeePass PSGallery PoShKeeP...
12.6.0.... VMware.CloudServices PSGallery PowerCLI...
7.0.3.1... VMware.DeployAutomation PSGallery This Win...
7.0.3.1... VMware.ImageBuilder PSGallery This Win...
12.7.0.... VMware.PowerCLI PSGallery This Win...
12.6.0.... VMware.PowerCLI.Sdk PSGallery Product ...
12.6.0.... VMware.PowerCLI.Sdk.Types PSGallery Types de...
12.6.0.... VMware.PowerCLI.VCenter PSGallery Modules ...
12.6.0.... VMware.PowerCLI.VCenter.Types.Ap... PSGallery Types de...
12.6.0.... VMware.PowerCLI.VCenter.Types.Ce... PSGallery Types de...
4.0.0.2... VMware.Sdk.Nsx.Policy PSGallery This Pow...
1.0.106... VMware.Sdk.Runtime PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere PSGallery This Pow...
3.0.104... VMware.Sdk.vSphere.Appliance PSGallery This Pow...
2.0.104... VMware.Sdk.vSphere.Appliance.Access PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Appliance.Health PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Appliance.Inf... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Appliance.Loc... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Appliance.Log... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Appliance.Net... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Appliance.Rec... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Appliance.Sup... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Appliance.System PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Appliance.Update PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Cis PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Cis.Tagging PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Content PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.ContentLibrary PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Esx.Hcl PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Esx.Hosts PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.Esx.Settings PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.VAPI.Metadata PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Authe... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.CertM... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Content PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Datas... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Deplo... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Guest PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Identity PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Inven... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.ISO PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.LCM PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Names... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Names... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.OVF PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Services PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Storage PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Syste... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Tagging PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Topology PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Trust... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.VCHA PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.Vm PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vCenter.VmTem... PSGallery This Pow...
1.0.104... VMware.Sdk.vSphere.vStats PSGallery This Pow...
1.0.104... VMware.Sdk.vSphereRuntime PSGallery This Pow...
7.0.3.1... VMware.Vim PSGallery This Win...
12.6.0.... VMware.VimAutomation.Cis.Core PSGallery This Win...
12.0.0.... VMware.VimAutomation.Cloud PSGallery This Win...
12.7.0.... VMware.VimAutomation.Common PSGallery This Win...
12.7.0.... VMware.VimAutomation.Core PSGallery This Win...
12.7.0.... VMware.VimAutomation.Hcx PSGallery This Win...
12.7.0.... VMware.VimAutomation.HorizonView PSGallery This Win...
12.0.0.... VMware.VimAutomation.License PSGallery This Win...
12.5.0.... VMware.VimAutomation.Nsxt PSGallery This Win...
12.7.0.... VMware.VimAutomation.Sdk PSGallery This Win...
12.3.0.... VMware.VimAutomation.Security PSGallery This Win...
12.7.0.... VMware.VimAutomation.Srm PSGallery This Win...
12.7.0.... VMware.VimAutomation.Storage PSGallery This Win...
1.6.0.0 VMware.VimAutomation.StorageUtility PSGallery This Win...
12.7.0.... VMware.VimAutomation.Vds PSGallery This Win...
12.7.0.... VMware.VimAutomation.Vmc PSGallery This Win...
12.5.0.... VMware.VimAutomation.vROps PSGallery This Win...
12.4.0.... VMware.VimAutomation.WorkloadMan... PSGallery PowerShe...
12.7.0.... VMware.VumAutomation PSGallery This Win...
3.2.0 xWebAdministration PSGallery Module w...
2.0.0.2 xXMLConfigFile PSGallery This DSC...

 

 

2022-08-04 14:12:32.071 +01:00INFO__item_stack:/item5
2022-08-04 14:12:32.811 +01:00ERROR(com.vmware.library.powershell/invokeCommand) Error in (Dynamic Script Module name : invokeCommand#15) PowerShellInvocationError: Errors found while executing script
Add-PSSnapin : The Windows PowerShell snap-in 'VMware.VimAutomation.Core' is
not installed on this computer.
At line:1 char:1
+ Add-PSSnapin -Name VMware.VimAutomation.Core
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (VMware.VimAutomation.Core:Stri
ng) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad
dPSSnapinCommand

2022-08-04 14:12:32.823 +01:00ERRORWorkflow execution stack:
***
item: 'tag VM at Tanfield/item5', state: 'failed', business state: 'null', exception: 'PowerShellInvocationError: Errors found while executing script
Add-PSSnapin : The Windows PowerShell snap-in 'VMware.VimAutomation.Core' is
not installed on this computer.
At line:1 char:1
+ Add-PSSnapin -Name VMware.VimAutomation.Core
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (VMware.VimAutomation.Core:Stri
ng) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad
dPSSnapinCommand

(Dynamic Script Module name : invokeCommand#15)'
workflow: 'tag VM at Tanfield' (49da6560-482c-4e30-91ac-6da5e8afc714)
| 'attribute': name=host_1 type=PowerShell:PowerShellHost value=dunes://service.dunes.ch/CustomSDKObject?id='706caaae-0d47-42bb-b8c7-d140466677ce'&dunesName='PowerShell:PowerShellHost'
| 'attribute': name=sessionId type=string value=925693ad-1fa5-4a1d-9928-0fb4d4f541ad
| 'attribute': name=psName type=string value=VMware.VimAutomation.Core
| 'attribute': name=psPassThru type=boolean value=false
| 'attribute': name=psVerbose type=boolean value=false
| 'attribute': name=psDebug type=boolean value=false
| 'attribute': name=psOutVariable type=string value=
| 'attribute': name=psOutBuffer type=number value=
| 'attribute': name=psErrorVariable type=string value=
| 'attribute': name=useSecureConnection type=boolean value=true
| 'attribute': name=output type=PowerShell:PowerShellRemotePSObject value=
| 'input': name=WSUS type=string value=Wednesday
| 'input': name=Avamar type=string value=19 00 Virtual
| 'input': name=Classification type=string value=Non-Clinical
| 'input': name=vm type=VC:VirtualMachine value=dunes://service.dunes.ch/CustomSDKObject?id='svr-tan-vcenter.xcddahn.nhs.uk%2Cid:vm-320174'&dunesName='VC:VirtualMachine'
| 'input': name=ps_script1 type=string value=
| 'no outputs'
*** End of execution stack.

 

0 Kudos