VMware Cloud Community
gamename
Enthusiast
Enthusiast
Jump to solution

PowerCLI & Workflow

Hi,

I'm trying to convert a powercli script to use workflow (mostly so I can run cloning in parallel).  Will I have to wrap every "get-vm" etc in an "inlinescript {}" definition?

-T

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

I think it might be possible to reuse the session key, as Clinton described in his Multithreading PowerCLI  post


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

View solution in original post

Reply
0 Kudos
5 Replies
gamename
Enthusiast
Enthusiast
Jump to solution

Just to make my point a little clearer, I get this kind of error when calling powercli cmdlets:

Microsoft.PowerShell.Utility\Write-Error : The term 'Get-VM' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name

HTH

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

That seems to indicate the PowerCLI pssnapin is not loaded.

Did you do a

Add-PSSnapin VMware.VimAutomation.Core


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

wprather
Contributor
Contributor
Jump to solution

I suspect LucD is right because each parallel thread in the workflow is it's own powershell session.  You'll likely also need to call connect-viserver again.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I think it might be possible to reuse the session key, as Clinton described in his Multithreading PowerCLI  post


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

Reply
0 Kudos
thebart
Enthusiast
Enthusiast
Jump to solution

i think i'm getting close

Reply
0 Kudos