Browsed by
Category: Powercli & VMA

PowerCLI – useful tools

PowerCLI – useful tools

VMware PowerCLI is a powerful tool for daily task for every Admin. The pure console is most commonly used. However, there are a few alternatives to the simple console which could make the use of PowerCLI even more handy. I’ll describe them shortly in the next a few lines.

  1. Powershell ISE script editor, which provides a better user experience. It’s divided into two panes. The upper pane  is for viewing/editing script files, and the lower pane is for running individual commands and displaying their output (an analog of the standard PowerShell console).ISEYou can execute PowerCLI commands in the lower pane of PowerShell ISE or in the PowerShell console. It will be usefull also during the first steps with PowerCLI through analysing of some ready downloaded from Internet scripts.The most convenient way to do is to open a script in the upper pane of Powershell ISE. In this way you can select each individual command and executee by pressing F8 or “Run Selection” button. When the command execution is finished you will see “Completed” message at the bottom of the console.
  2. PowerGUI – it’s another script editor made by Quest Software which was acquired by Dell. powerguiIMHO it’s better organised than PowerShell ISE, the functions are rather simillar. However, instead of tabs with your scripts here you will be able to see the whole folder-tree with different kinds of scripts. It’s really helpful when you work with more than a few scripts.
VMware PowerCLI – Introduction

VMware PowerCLI – Introduction

To begin the jurney with PowerCLI we need to start from the installation of PowerCLI itself.

The installation can be done on a Windows based system, that could be some kind of an administration server. The installation files can be found on this VMware site.

There are a few versions available, they are released asynchronously with vSphere and the version numbers do not exactly correspond to vSphere versions. The most recent version is 6.5 whilst there are other like 6.3, 6.0 or 5.8 available.

Before you install the PowerCLI I recommend to change the Execution Policy of Powershell. It is required to run scripts. To do it, run Windows PowerShell as administrator and execute fallowing command:

Set-ExecutionPolicy RemoteSigned

The installation process is really straightforward, that’s why I will not spam the screanshoots of installations here.

After you finish the installation you can run it and see the first Welcome screen like this:

powercli1

 

The first command I suggest to use is:

Get-VICommand

it lists all the available commands. However to display any information about virtual infrastructure you need to connect to a vCenter server or ESXi host. We will do it in the next part after introduction of useful tools which can be used in conjunction with PowerCLI.

PowerCLI course

PowerCLI course

I was always keen on getting deeper knowledge about PowerCLI or in other words – start to use it in daily administrative tasks. I decided to do something with it and I think it would be the best way to write my own guide in a form of structured notes and share it here with you. Perhaps someone would find it useful.

Therefore in PowerCLI & VMA tab you could find an agenda of this course which will be systematically updated with next parts.

There are planned fallowing parts:

  1. VMware PowerCLI – Introduction
  2. Useful Tools
  3. Basic commands to generate and export reports
  4. Monitoring VMs with PowerCLI
  5. Managing VMs using PowerCLI
  6. Managing multiple VMs based on their tags
  7. Monitoring ESXi hosts with PowerCLI
  8. Managing ESXi hosts using PowerCLI
  9. Managing virtual networks using PowerCLI
  10. Managing Cluster-wide settings using PowerCLI
  11. Complete ESXi configuration with a single script

 

If you have any sugestions what else should be included in such course, do not hesitate to contact me via comments.