PowerCLI Primer

Picked this up from VMware Trainer blog

 

Power CLI primer

Just like many of the network professionals out here , I too believe that life is too short to learn all those command prompt tools and stick on to a graphical version of any tool if it is available . But some times the command prompt based tools can be indispensable if you have to do things repeatedly . For creating a single VM per day , I will surely use vsphere client , but for 50 VM per day , I prefer some method by which I can automate the process. That is the role the power CLI is playing in a vSphere environment .
This post is just a basic introduction in to the basic aspects of power CLI. Personally I am preparing this as a reference to me itself so that I will not miss any of the concepts of power CLI for my VCAP-DCA exam .
to begin your experiment with powerCLI , install it to any windows machine on your network . You can download it here 
installation is pretty straightforward . Finish it and open power CLI from all programs –vmware –vmware power CLI . but  wait , if you try to do it , you will be greeted with an error message like this .

Now try to open the same program with administrative privileges , ie right click and select run as administrator , you will find that the same error repeats this time also . But it is now time for us to set the execution policy of the PowerCLI to ” remoteSigned ” it will allow us to run scripts that have written on the local computer . That is exactly what we need to do . The default mode is restricted and that is why we are getting all those red colored scary messages . so go ahead and type this
set -executionPolicy Remotesigned
next time when you bring the powerCLI up , it will greet you in a much more pleasant manner . Remember that you don’t have to run it in administrative mode anymore for normal operations .

Now let us start by connecting to an ESXi host  or a vCenter Server . use the command   connect-Viserver  < ipadress or FQDN >
it will pop up a message asking for the user name and password . There are two option to avoid  it and specify it along with the commands
connect-viserver < ipaddress>  -user root -password P@ssw0rd  or you can use the credential variable  $Credential=Get-Credential and using the value $credential along with the command like  connect-viserver< ipaddress>  -credential $credential 


connect-VIserver -Menu is a nice option to list all your previously connected servers and you can choose one to which you wish to connect .

Advertisements

Beginning my quest for VCDX-DCV

for years now I have debated on MCSE vs VCDX.  with the recent switch by MS away from the tried and true MCSE to the app based certification I have finally made up my mind.  VMware has been a company that has remained the same for many years now.  always having the VCP, VCAP and then the VCDX.  VCDX has always meant that you have reached the pinnacle of your art and achieved a certification to prove it.  I have decided that I want to achieve that cert. I have been using VMWare for many years now and have always felt it was a very mature product.  Something that MS has always wanted to achieve with its Hyper-V offering.  However MS always seems to fall just short of the mark and then they change the entire infrastructure of things and try and force the industry to comply.  I am quite tired of that attitude so have thrown in my hat to supporting the real standard of virtualization, VMWare.

I have signed up to take the obligatory ICM class (Install/Configure/Manage) and will be taking that beginning next week.  then I begin my cert journey towards VCP-DCV (data center virtualization) and VCAP-DCV  then to pick up a project that is VCDX worthy and begin my design docs for that project.