pamiller21
Enthusiast
Enthusiast

Script Failing to Run

Jump to solution

I am at a loss, I noticed a script I use to deploy new VMs seems to have started to fail to run automatically so I started to dig into it.  If I tell the script to run all it shows is this:

[root@vmware-util ~]# pwsh /home/scripts/actions-regular/Automation/VM-DeploymentBuild1.ps1
Exception: The VMware.ImageBuilder module is not currently supported on the Core edition of PowerShell.

If I take the content of the script and paste it into powershell it works fine.  I am not sure what I am missing today. Here is the version I am running in case that is a problem:

PS /root> Get-PowerCLIVersion

PowerCLI Version
----------------
VMware PowerCLI 12.2.0 build 17538434
---------------
Component Versions
---------------
VMware Common PowerCLI Component 12.3 build 17838947
VMware Cis Core PowerCLI Component PowerCLI Component 12.3 build 17839331
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 12.3 build 17839688

0 Kudos
1 Solution

Accepted Solutions
Zsoldier
Expert
Expert

Assuming that script is using the vmware.imagebuilder module, you'll need to run that particular script in "Windows Powershell" with vmware.powercli module installed.

Powershell Core is OS-agnostic version that not all modules have been ported to.

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier

View solution in original post

0 Kudos
5 Replies
Zsoldier
Expert
Expert

Assuming that script is using the vmware.imagebuilder module, you'll need to run that particular script in "Windows Powershell" with vmware.powercli module installed.

Powershell Core is OS-agnostic version that not all modules have been ported to.

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos
pamiller21
Enthusiast
Enthusiast

That is the confusing part, if I copy all the content of the script and paste it into the powershell window it all works, no errors.

0 Kudos
pamiller21
Enthusiast
Enthusiast

I uninstalled some of the modules that I don't need and now it works.  Thank you for looking into this still!

0 Kudos
LucD
Leadership
Leadership

Just a warning for future readers of this thread.

It is highly unlikely that uninstalling a module fixes the issue that the VMware.ImageBuilder module is not supported on PowerShell v6 or higher 🤔


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

LucD
Leadership
Leadership

Update: since PowerCLI 13.0 the ImageBuilder module is supported on all PS platforms and versions.
See PowerCLI 13 is now GA!


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

0 Kudos