VMware Cloud Community
SteveR77
Contributor
Contributor
Jump to solution

Troubleshooting PowerCli Code

I am currently working on a script that uses Luc D's Get-FolderByPath function to allow me to deploy a VM to a specific folder in my vSphere environment.   However, when I run the code I am getting the following error even though the VM is created correctly -

Get-Inventory:  Cannot validate argument on parameter 'Name'.  The argument is null or empty.  Provide an argument that is not null or empty, and the try the command again.

The code is attached.  Being new to PowerCLi everything appears to be proper so I am not seeing why the error is being thrown as the values should be set by the parameters that are defined.

Thank you for your assistance with this and helping me to become more proficient.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The code in the Word document seems to be garbled up.

Could you perhaps attach your code in a flat text file ?


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

The code in the Word document seems to be garbled up.

Could you perhaps attach your code in a flat text file ?


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

0 Kudos
SteveR77
Contributor
Contributor
Jump to solution

Luc D,

Apologies for that.   However, I actually resolved this.  I had a trailing / in the path for the -Path parameter which of course threw everything off.

Thank you for more amazing code to help me achieve my goals.

0 Kudos
SteveR77
Contributor
Contributor
Jump to solution

Luc D,

I have attached what I hope will be a clean version of the code which may assist someone else.

Thanks again and make it a great day.   Smiley Happy

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Great !

Thanks for sharing


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

0 Kudos