VMware Cloud Community
pauljawood
Enthusiast
Enthusiast
Jump to solution

Quick question on PowerCli

Hi,

I have found a great script by LucD (http://www.lucd.info/2009/12/02/raiders-of-the-lost-vmx/#more-1103) but I would like to be able to have the templates imported to a specific folder.

As always LucD's scripts are stunning and a great asset to everyone.

I hope there is a quick bit of code that I can add to the script to get this finally resolved.

If you found this helpful then please leave some points.
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Solution isn't that difficult.

I added a new parameter called -Folder.

With that parameter you can specify the name of the target folder or the folder object.

That 2nd option is there to allow you to specify a specific folder when you have folders with the same name in your environment.

Some sample calls

Register-VMX -dsNames "datastore1" -Template:$true -Folder (Get-Folder Templates -Location (Get-Datacenter MyDatacenter))
Register-VMX -dsNames "datastore1" -Template:$true -Folder "Templates" 

Let me know if the attached script works.

If yes, I will update my blog post.


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

View solution in original post

0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

Thanks for the kind words.

You are using the -Template parameter I assume.

What is missing, if I understand correctly, is that you want ot be able to specify a 'blue'folder where the templates need to be registered ?


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

pauljawood
Enthusiast
Enthusiast
Jump to solution

Hi LucD,

Yes that is correct I would like to have the templates or vmx files going to certain folders. In the case of the vmtx files imported I would like to have them registered to a folder called 'Templates'.

I hope that makes sense and the solution is easy.

If you found this helpful then please leave some points.
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Solution isn't that difficult.

I added a new parameter called -Folder.

With that parameter you can specify the name of the target folder or the folder object.

That 2nd option is there to allow you to specify a specific folder when you have folders with the same name in your environment.

Some sample calls

Register-VMX -dsNames "datastore1" -Template:$true -Folder (Get-Folder Templates -Location (Get-Datacenter MyDatacenter))
Register-VMX -dsNames "datastore1" -Template:$true -Folder "Templates" 

Let me know if the attached script works.

If yes, I will update my blog post.


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

0 Kudos
pauljawood
Enthusiast
Enthusiast
Jump to solution

Hi LucD,

I can confirm that I have tried both and it works like a charm. I cannot thank you enough for the scripts that you produce and would like to know what you think is one of the better books to buy to get a better understanding of PowerCli.

If you found this helpful then please leave some points.
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Well, I'm probably a bit biased, but there is a good book going to come out shortly. 😉

And there is also Hal's book.


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

pauljawood
Enthusiast
Enthusiast
Jump to solution

Hi LucD,

I have to say I'm really looking forward to the book and sure many people will be buying it. Many thanks again for the help today.

If you found this helpful then please leave some points.
0 Kudos