6 Replies Latest reply on Jan 7, 2011 4:05 AM by pauljawood

    Quick question on PowerCli

    pauljawood Enthusiast

      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.

        • 1. Re: Quick question on PowerCli
          LucD Guru
          Community WarriorsUser ModeratorsvExpert

          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: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          1 person found this helpful
          • 2. Re: Quick question on PowerCli
            pauljawood Enthusiast

            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.

            • 3. Re: Quick question on PowerCli
              LucD Guru
              vExpertUser ModeratorsCommunity Warriors

              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: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
              • 4. Re: Quick question on PowerCli
                pauljawood Enthusiast

                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.

                • 5. Re: Quick question on PowerCli
                  LucD Guru
                  User ModeratorsCommunity WarriorsvExpert

                  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: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                  1 person found this helpful
                  • 6. Re: Quick question on PowerCli
                    pauljawood Enthusiast

                    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.