How to manage ESXi hosts remotely with PowerCLI

How to manage ESXi hosts remotely with PowerCLI

How to manage ESXi hosts remotely with PowerCLI

When choosing to administer VMware-based virtual machines (VMs), administrators have a few decisions to make when prepping their bare-metal hosts and configuring the guest OSes, the storage spaces, and switches used to communicate with each other and across networks. The choices center on how to…Read More


VMware Social Media Advocacy

New Release: PowerCLI 11.0.0

New Release: PowerCLI 11.0.0

New Release: PowerCLI 11.0.0

PowerCLI has been moving at quite the rapid pace over the last 2 years. In 2018, we’ve been releasing roughly every other month to make sure we get the latest features, performance improvements, and updates available as quickly as possible. Well, it’s been two months and we’re not going to break this trend. Today, we […] The post New Release: PowerCLI 11.0.0 appeared first on VMware PowerCLI Blog .


VMware Social Media Advocacy

New Release: VMware PowerCLI 10.0.0

New Release: VMware PowerCLI 10.0.0

New Release: VMware PowerCLI 10.0.0

We are only two months in to 2018, but it has already been pretty exciting from an automation standpoint. Let’s review some of the big news. Microsoft open-sourced and released PowerShell 6.0. They also made it available on a number of operating systems, from Windows to Linux to Mac OS. Then, PowerCLI hit 2,000,000 downloads […] The post New Release: VMware PowerCLI 10.0.0 appeared first on VMware PowerCLI Blog .


VMware Social Media Advocacy

PowerCLI 6.5.1 Installation Walkthrough

PowerCLI 6.5.1 Installation Walkthrough

PowerCLI 6.5.1 Installation Walkthrough

We released PowerCLI 6.5.1 two weeks ago and the response has been incredible! The VMware.PowerCLI module is closing in on 4,000 downloads from the PowerShell Gallery and we’ve received a ton of good feedback. There seems to be quite a few questions and comments over this new installation method so I created a walkthrough video […] The post PowerCLI 6.5.1 Installation Walkthrough appeared first on VMware PowerCLI Blog .


VMware Social Media Advocacy

Building a Home Lab for PowerCli Testing

Building a Home Lab for #PowerCli Testing – Notes of a scripter

Building a Home Lab for PowerCli Testing

After taking the PowerCli HOL from VMware, I been thinking of putting together a home lab. I been reading a lot of information about others bloggers using Mini PCs- such as the Intel NUCs, Mac Minis, and even custom built whitebox servers. Unfortunately, being a father of 3 kids means I have to be on a tight budget, and at the same time I don’t want to skimp and have a under powered home lab. I would also like the equipment to be quiet and fan-less if at all possible.


VMware Social Media Advocacy

Script to Add Multiple NFS Datastores to an ESXi Host

I am sure I’m not the first admin that has needed to add an NFS datastore to multiple hosts, and usually it’s multiple datastores that are needed as well. Normally, I would go to each host, and add the storage manually via the vSphere Client.  But after doing this for quite some time, I decided I needed a better way to get this task done.  Scripting!

I have recently started to use PowerCLI to automate many of my daily tasks (Hint: more scripts to come) and decided to share the one I’ve used the most first.  The script takes an input after running, asking you to input your host name.  Inside the script, you will set the datastores you want to add to the host.  Those are the only changes that are needed when being run.  This script has saved me a great deal of man hours and some headaches.  A great advantage to scripting is that you avoid those sneaky spelling mistakes or clicking the wrong button.

The script is below here (The bold parts are what need to be changed by you):

$VMHost = (Read-Host “Please enter the name of your ESX Host you wish to configure”)

$shellObject = new-object -comobject wscript.shell
$intAnswer = $shellObject.popup(“Do you want to add the datastores?”, 0,”Add datastores – remember you must have added the hosts on the storage”,4)
If ($intAnswer -eq 6) {
Write “Creating Datastores on $VMHost…”
New-Datastore -Nfs -VMHost $VMHost -Name DatastoreName1 -Path /vol/DatastoreName1 -NfsHost 192.168.255.251
New-Datastore -Nfs -VMHost $VMHost -Name DatastoreName2 -Path /vol/DatastoreName2 -NfsHost 192.168.255.251
New-Datastore -Nfs -VMHost $VMHost -Name DatastoreName3 -Path /vol/DatastoreName3 -NfsHost 192.168.255.251
} else {
Write “Skipping Datastores on $VMHost…”
}

When running the script, you will see the following output asking you to put in your hostname:

addnfsdatastore

You will then see a successful message for each datastore added to the host. You must remember to add the host to the NFS Export share on the storage itself before completing this step.

Script courtesy of VMware PowerCLI Blog