0% found this document useful (0 votes)
87 views17 pages

PowerCLI - Rnelson0

This document discusses using vSphere tags to automate Veeam backup jobs based on policies. It defines a tag category called "VeeamPolicy" with tags for different backup requirements like RPO, retention period and no backups. Scripts are provided to apply these tags to VMs based on location or other attributes. Finally, the document shows how to create Veeam backup jobs that use the tags to automatically include or exclude VMs matching certain policies.

Uploaded by

vashsau
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views17 pages

PowerCLI - Rnelson0

This document discusses using vSphere tags to automate Veeam backup jobs based on policies. It defines a tag category called "VeeamPolicy" with tags for different backup requirements like RPO, retention period and no backups. Scripts are provided to apply these tags to VMs based on location or other attributes. Finally, the document shows how to create Veeam backup jobs that use the tags to automatically include or exclude VMs matching certain policies.

Uploaded by

vashsau
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

PowerCLI | rnelson0

1 of 17

https://rnelson0.com/category/powercli/

rnelson0
Infrastructure, Virtualization, Security

Category Archives: PowerCLI

POSTED BY
RNELSON0
POSTED ON
JUNE 29, 2016
POSTED UNDER
POWERCLI, VSPHERE
COMMENTS
1 COMMENT

Tag-based Veeam Backups


As I teased in Using vCenter tags with PowerCLI (h ps://rnelson0.com/2016/06/27/using-vcentertags-with-powercli/), I want to explore how to use tags in a practical application. To refresh our
memory, we looked at creating an Ownership category with individual tags in it, and limited VMs to
having just one of the tags. We created a li le script that denes our schema, in case we need to
re-create it. We are going to work on a new category today for our backups. Specically, Veeam
backups, based on SDDC6282-SPO, Using vSphere tags for advanced policy-driven data protection
(h p://vmware.mediasite.com/mediasite
/Play/6f4f80b0f85044c1a6933352cb8cfc3d1d?catalog=1c95c1d4-0353-4ae1-b3ed-a5067a 57aa) as
presented at VMworld 2015.

Defining Policy and Tags


To create our backup jobs, we need to know a few things that will translate into our tag schema. Our
14-08-2016 01:51

PowerCLI | rnelson0

2 of 17

https://rnelson0.com/category/powercli/

backup policies are dened by a combination of ownership, recovery point objective


(h ps://en.wikipedia.org/wiki/Recovery_point_objective) (RPO), and the retention period. For
example, our Development group is okay with a 24 hour RPO and backups that are retained for a
week. Operations may require a 4 or 8 hour RPO and require 30 days of backups. Each of those
combinations will require a separate backup job. We can combine these tuples of information into
individual tags so that Veeam can make use of them. We also need one more tag for VMs that do not
need any backup at all. We can put all of this in a tag category called VeeamPolicy. Heres what that
might look like, again in PowerShell:

New-TagCategory -Name VeeamPolicy -Description "Veeam Backup Policy" -Cardinality Si


New-Tag -Name "NoRPO" -Category VeeamPolicy -Description "This VM has no backups"
New-Tag -Name "Development24h7d" -Category VeeamPolicy -Description "Development VMs
New-Tag -Name "Operations8h30d" -Category VeeamPolicy -Description "Operations VM wi
New-Tag -Name "Sales48h30d" -Category VeeamPolicy -Description "Sales VM with 48 hou

This creates the category for the VeeamPolicy tags, a single tag for VMs that explicitly do NOT
require backups, and three group/RPO/retention tuples. Go ahead and place this in revision control,
so that over time, you can track the tags you are using. Tags are part of vCenter, so if you migrate to
another or recreate your vCenter, youll need this! It also makes it easy to see what youve dened vs
whats actually in vCenter.
Next, we want to tag some VMs. Theres a number of ways this can be done, depending on how your
VMs are organized. If we assume a simple VM and Templates folder structure where VMs are
grouped by the owning organization (Development, Operations, Sales, Marketing, etc), we can tag all
the VMs with NoRPO, then tag VMs in the relevant folders with the relevant tag. That would look
like this:
# Default policy is NoPRO
Get-VM | % {
New-TagAssignment -Entity $_ -Tag "NoRPO"
}

# Find Development VMs by Location


@(Get-VM -Location "Development") +
@(Get-Template -Location "Development") | % {
Remove-TagAssignment -TagAssignment (Get-TagAssignment -Entity $_ -Category VeeamP
New-TagAssignment -Entity $_ -Tag Development24h7d
}

Its important to look for VMs and templates. The @() structure creates arrays, which can be added
together. We then have to remove the previous assignment before placing the new one, since our
category is Single cardinality (Unfortunately you cannot overwrite the current tag assignment, boo!).
Note: The Location parameter takes a string, and it nds ALL folders that match the string. If you
have a VM and Templates folder named Operations and a Datastore folder called Operations, All the
VMs in BOTH will be discovered. I recommend adding DS to the end of datastore folders, VDS
or VSS to the end of Network folders, etc., to ensure theres no conict here.

14-08-2016 01:51

PowerCLI | rnelson0

3 of 17

https://rnelson0.com/category/powercli/

You could also look for VMs by datastore folders:

# Find Development VMs by Datastore Location


$DevelopmentDatastores = Get-Datastore -Location "Development Datastores"
@(Get-Template -Datastore $DevelopmentDatastores) +
@(Get-VM -Datastore $DevelopmentDatastores) | % {
Remove-TagAssignment -TagAssignment (Get-TagAssignment -Entity $_ -Category VeeamP
New-TagAssignment -Entity $_ -Tag Development24h7d
}

You may also have a more complicated layout for groups, such as Operations, where you do not
want all the VMs underneath a top level folder to receive the same tag. We can instead combine some
individual folders underneath and list some VMs in them that we want to be left as NoRPO by
adding some selection criteria and skip the individual VMs:

# Find Operations VMs


$OperationsExemptVMs = 'veeamproxy1', 'veeamproxy2'
@(Get-VM -Location "Domain Controllers", "Management", "vSphere", "Templates for pat
@(Get-Template | ? { (Get-TagAssignment -Entity $_) -eq $null } ) | % {
# Skip these VMs which will not be backed up
if ( $OperationsExemptVMs -contains $_.Name.ToString() ) {
return
}

Remove-TagAssignment -TagAssignment (Get-TagAssignment -Entity $_ -Category VeeamP


New-TagAssignment -Entity $_ -Tag Operations24h30d
}

Theres a ton of other ways to select your VMs, this is just a sampling. If your organization could best
be described as Chaotic, then you might have to assign Tags individually. However your tagging
happens, when youre done, you probably want a report so you can ensure everything was tagged
properly. We can do that, too!

# Report on the current tag status


@(Get-VM) + @(Get-Template) | Get-TagAssignment -Category VeeamPolicy | Select Entit

Open the resulting CSV le and well have all our VMs and Templates and the Tag they were
assigned. Print it out, red pen it, and tweak our categorizations. You can re-run the Find GROUP VMs
sections, or if you want to start over, just delete the tag category and run the whole le again:
Remove-TagCategory VeeamPolicy

Tweak it till you get it right, and commit it to version control again. One last set of statements you
may want to use is to nd non-tagged VMs, either as part of your script (if you do not assign
14-08-2016 01:51

PowerCLI | rnelson0

4 of 17

https://rnelson0.com/category/powercli/

everything NoRPO) or on an intermi ent basis to ensure every VM and Template is tagged:

@(Get-VM) + @(Get-Template) | ? { (Get-TagAssignment -Category "VeeamPolicy" -Entity

Creating Veeam Backup Jobs


Now that we have our policy dened and tags applied, lets create some jobs. We will be creating
three jobs, one each for Development, Operations, and Sales. We will assume that automatic proxy
selection will work and that there is only one repository, as those details arent important to the use
of tags. This article was wri en using Veeam Backup & Replication v9, so if youre reading this in the
future, things may look dierent!
One last thing to note, and you may have gured this out already, is that when using Tags for our
selection process, its an OR operation, not an AND operation. This means that if you select two tags,
Veeam will nd all VMs that match either tag, rather than VMs that much all the tags. Thats why we
have three pieces of information in our tag! Theres a request to support logical AND
(h ps://forums.veeam.com/veeam-backup-replication-f2/support-for-logical-and-with-vcentertags-based-jobs-t36054.html) please comment in that thread if you think youd nd this interesting
as well! If this is delivered in the future, it could really change how this is done!
Create a new backup job for Development:

14-08-2016 01:51

PowerCLI | rnelson0

5 of 17

https://rnelson0.com/category/powercli/

(h ps://rnelson0.les.wordpress.com/2016/06/veeam-tag-based-backups-g-1.png)
On the next page, click Add, then click on the right-most icon (Tags) and expand and select the
Development24h7d tag and hit Add then Next.

(h ps://rnelson0.les.wordpress.com/2016/06/veeam-tag-based-backups-g-2.png)
On the storage page, change the Retention Policy 7 days. This is also where we can hit Advanced and
modify Quiesce se ings, Notications, and most other backup se ings. Click Next when done.

14-08-2016 01:51

PowerCLI | rnelson0

6 of 17

https://rnelson0.com/category/powercli/

(h ps://rnelson0.les.wordpress.com/2016/06/veeam-tag-based-backups-g-3.png)
Make any selections we need to on the Guest Processing screen (not shown) and click Next. Now set
up our schedule (not shown). Since this is a 24h RPO, this should run at least once a day (more is
okay, if wed like). Click Create to nish the job setup. We should end up with something like this:

(h ps://rnelson0.les.wordpress.com/2016/06/veeam-tag-based-backups-g-4.png)
Now, every day at 10:00:00PM, the Development job runs. Veeam will contact the vCenter server and
enumerate every VM with the Development24h7d tag, add them to the job, and then start backing
them up. If the Development team deletes a VM, its automatically no longer part of the job. If they
add a VM, and they tag it properly, its automatically part of the job. All we need to do is teach or
coworkers how to tag their new VMs, hopefully with the assistance of automation, and use our
PowerShell command from above to run a report every days to nd any untagged VMs. Its okay to
tag a VM with NoRPO, because its explicit acknowledgement that a VM does not require backups,
but the lack of a tag does not mean that backups are not needed.
We can also use combine the use of tags with exclusions. For example, if we have some close VMs
and some remote VMs on a slower link, they probably do not use the same repository at HQ. In the
close job, we exclude the remote sites clusters or datastores, and on the remote job, we exclude
HQs clusters or datastores. If we have two or three sites, this is probably pre y easy. If we have
multiple sites, we may want to revisit our tag scheme and add a fourth item to the tags Location
and re-align our jobs. Of course, if the AND selection criteria is added in the future, this will
change, as individual tags wont need to carry EVERY piece of information.
14-08-2016 01:51

PowerCLI | rnelson0

7 of 17

https://rnelson0.com/category/powercli/

Summary
Today, we created a tag schema oriented around our backup policies. We also built some reports
showing how VMs are tagged and which VMs are not tagged. This script was commited to version
control for accurate tracking over time and re-creation of the schema if needed. We then created some
simple but dynamic Veeam backup jobs based on the tags, and showed our coworkers how to
leverage the tags. This is a great start for simplifying your Veeam backup jobs and to see the practical
power of vCenter Tags. Theres a lot more you can do with Tags, and with your Veeam jobs. Id love
to hear how youre using Tags in the real world in the comments or on twi er (h ps://twi er.com
/rnelson0). Thanks!

POSTED BY
RNELSON0
POSTED ON
JUNE 27, 2016
POSTED UNDER
POWERCLI, VSPHERE
COMMENTS
2 COMMENTS

Using vCenter tags with PowerCLI


I was recently introduced to some practical usage of vCenter tags. I used tags to build a fairly easy
and dynamic set of sources for Veeam backup jobs, but before I get into that, I want to explain tags a
li le bit for those who are not familiar with them.
Tags are something that are pre y easy to understand conceptually. You create a category which
contains a few tags. An object can receive one or multiple tags from a given category. Tags are
managed by vCenter, not by vSphere, so require a license that provides vCenter for management.
Thats a pre y simple explanation and list of requirements.
A Tag Category has a collection of Tags available within it. If the Category is single cardinality, it
means that an object can only be assigned one tag in the category. This might be good for a category
associated with ownership or recovery point objective (RPO). A Category can also be multiple
cardinality, where a single object can be assigned multiple tags in a category. This would be helpful
to associate applications with a VM, or a list of support teams that need notied if there is a planned
impact or outage.
Im going to show you how to manage Tags and Tag Categories with PowerCLI (Specically with the
PowerShell ISE and a prole to load PowerCLI (h ps://rnelson0.com/2014/04/04/powershell14-08-2016 01:51

PowerCLI | rnelson0

8 of 17

https://rnelson0.com/category/powercli/

prole/)), but you can manually create and manage them through the vSphere Web Client, under the
Tags item on the left hand menu. You can create and delete and rename tags and categories there all
day long, and you can right click on an object almost anywhere else and select Edit Tags to edit the
assigned tags on it. When you view most objects, youll see an area in the Summary tab labeled Tags
that will display and let you manage assignments.

(h ps://rnelson0.les.wordpress.com/2016/06/vcenter-tags-g-1.png)

(h ps://rnelson0.les.wordpress.com/2016/06/vcenter-tags-g-2.png)
Lets look at how to automate this with PowerCLI. Dont forget to Connect-VIServer <vCenter name>
before continuing. Use the cmdlets *-TagCategory, *-Tag, and *-TagAssignment to manage
Categories, Tags, and the assignment of tags to objects, respectively. We start by creating a category
using New-TagCategory. This accepts the parameters Name*, Cardinality, Description, EntityType, and
Server. A new tag is created with New-Tag, as youd expect, with parameters Category*, Name*,
Description, and Server. Asterisks denote required parameters. Both accept the optional Conrm and
WhatIf arguments, the la er of which is extremely helpful while you plan out your tag schemes.
As an example, lets create an Ownership tag category. This will be a single cardinality for most, as
most objects will be owned by a single group, but if some objects share ownership, be sure to create it
as a multiple-cardinality category. We can restrict the type of entities it applies to with a comma
separated list of any of the valid types: Cluster, Datacenter, Datastore, DatastoreCluster,
DistributedPortGroup, DistributedSwitch, Folder, ResourcePool, VApp, VirtualPortGroup,
VirtualMachine, VM, VMHost (you can see this list any time by reading the New-TagCategory help
pages). Many can probably restrict this to VMs and maybe Datastores, as everything else is likely
14-08-2016 01:51

PowerCLI | rnelson0

9 of 17

https://rnelson0.com/category/powercli/

owned by the same single team. WhatIf is helpful to make sure we have the syntax we want before we
apply it. We can put these values into the Command add-on and click Insert to see what the
PowerCLI looks like:

(h ps://rnelson0.les.wordpress.com
/2016/06/vcenter-tags-g-3.png)

C:\> New-TagCategory -Name Ownership -Cardinality Single -Description "Group ownersh

Select New-Tag in the command add-on and add a tag for a group called Development in the new
category, then click Insert:

14-08-2016 01:51

PowerCLI | rnelson0

https://rnelson0.com/category/powercli/

(h ps://rnelson0.les.wordpress.com
/2016/06/vcenter-tags-g-4.png)

C:\> New-Tag -Category Ownership -Name Development -Description "We put the Dev in D

You can now create a script with a few more groups, copy and pasting the above line as a start, and
plan out your tag scheme:

(h ps://rnelson0.les.wordpress.com/2016/06/vcenter-tags-g-5.png)
Run the commands (F5 in ISE) and make sure there are no errors, but unfortunately there will be:

10 of 17

C:\> New-TagCategory -Name Ownership -Cardinality Single -Description "Group ownersh


New-Tag -Category Ownership -Name Development -Description "We put the Dev in DevOps
New-Tag -Category Ownership -Name Operations -Description "We put the Ops in DevOps"
New-Tag -Category Ownership -Name Sales -Description "We sell what doesn't exist" -W
New-Tag -Category Ownership -Name Financial -Description "We make sure your paycheck

What if: Create tag category 'Ownership' on server 'vcsa'


New-Tag : 6/27/2016 4:16:02 PM
New-Tag
Could not find TagCategory with nam
At line:2 char:1
+ New-Tag -Category Ownership -Name Development -Description "We put the Dev in De .
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

14-08-2016 01:51

PowerCLI | rnelson0

https://rnelson0.com/category/powercli/

Unfortunately, each command in WhatIf mode is run without knowledge of the previous or following
statements, so the rst New-Tag statement is unaware that a new tag category would have been
created. Remove the WhatIf from the rst line and run it again:

C:\> New-TagCategory -Name Ownership -Cardinality Single -Description "Group ownersh


New-Tag -Category Ownership -Name Development -Description "We put the Dev in DevOps
New-Tag -Category Ownership -Name Operations -Description "We put the Ops in DevOps"
New-Tag -Category Ownership -Name Sales -Description "We sell what doesn't exist" -W
New-Tag -Category Ownership -Name Financial -Description "We make sure your paycheck

Name
---Ownership
What if: Create
What if: Create
What if: Create
What if: Create

tag
tag
tag
tag

Cardinality Description
----------- ----------Single
Group ownership for VMs
'Development' in category 'Ownership'
'Operations' in category 'Ownership'
'Sales' in category 'Ownership'
'Financial' in category 'Ownership'

You can delete or edit the Tags and Categories using Remove-TagCategory, Remove-Tag,
SetTagCategory, and Set-Tag. These cmdlets use mostly the same parameters; use the Command
Add-On or Get-Help for more details. You can inspect the Tags and Categories that exist with
Get-Tag and Get-TagCategory.
C:\> Set-TagCategory -Category Ownership -Description "Organizational ownership for
Name
---Ownership

Cardinality Description
----------- ----------Single
Organizational ownership for VM

C:\> Get-TagCategory
Name
---Ownership

Cardinality Description
----------- ----------Single
Organizational ownership for VM

I recommend saving your Tag scripts in version control, so you can recreate or adjust them as
needed. Next time, well look at how to assign tags to objects in order to solve a specic problem:
backups!

POSTED BY
RNELSON0

11 of 17

14-08-2016 01:51

PowerCLI | rnelson0

https://rnelson0.com/category/powercli/

POSTED ON
NOVEMBER 7, 2014
POSTED UNDER
POWERCLI, VDM30IN30
COMMENTS
LEAVE A COMMENT

PowerShell Command Add-On


Many of us use PowerCLI, which relies on PowerShell. The default PowerCLI environment is pre y
plain, but you can also use the PowerShell ISE and load the PowerCLI snap-ins in your prole
(h ps://rnelson0.com/2014/04/04/powershell-prole/). The ISE, or Integrated Scripting Environment,
oers a lot of advantages to the regular PowerCLI or PowerShell interfaces: Intellitype, lots of
keyboard shorts, and something called the Command Add-On.
First, lets look at how to turn it on. Fire up the ISE. If you have Powershell pinned on your taskbar,
you can right click and choose the ISE, or just hit the windows key and type ISE. You want the
regular version of PowerShell ISE, not the (x86) version. Now that its open, go to View -> Show
Command Add-On and select it:

(h ps://rnelson0.les.wordpress.com/2014/11/g-1.png)

POSTED BY
RNELSON0
POSTED ON
NOVEMBER 7, 2014
POSTED UNDER
DEVOPS, POWERCLI, VDM30IN30
12 of 17

14-08-2016 01:51

PowerCLI | rnelson0

https://rnelson0.com/category/powercli/

COMMENTS
LEAVE A COMMENT

Use existing definitions as a baseline


Sometimes we spend way too long trying to dene things in our head when we can get existing
congurations from the system. Its vital to have a full service denition or any promotion of the
service through environments will turn up missing components and make your life hell. If youre
building a new service that looks similar to an old one, or evolves the old service, steal the old
services denition and then modify it.

vSphere
There are a number of ways to gather existing service denitions. If youre building a new host and
you have Enterprise Plus licenses, use Host Proles. Export an existing hosts cong to a host prole,
uncheck the irrelevant portions, change whats relevant but dierent, and apply to the new host. It
might take a few tweaks, but youll get it right soon. Then export the new hosts cong to a host
prole and youre good to go.
If you dont have Enterprise Plus, take a look at PowerCLI. It will take more legwork, but there are a
ton of cmdlets available to capture networking, storage, and other service denitions from existing
hosts which you can then apply elsewhere.

POSTED BY
RNELSON0
POSTED ON
JULY 9, 2014
POSTED UNDER
POWERCLI
COMMENTS
LEAVE A COMMENT

Snapshots and Automated Emails


A common problem in virtualization is snapshots. The name snapshot makes us (novice or
otherwise!) think of a picture in time, which sometimes leads to the belief that the snapshot is
taken and then stored somewhere, though thats not how snapshots really work.
13 of 17

14-08-2016 01:51

PowerCLI | rnelson0

https://rnelson0.com/category/powercli/

In reality, snapshots create a psuedo-consistent state of the virtual disk at that point in time.
Subsequent writes in a snapsho ed state are redirected to delta les. If you are performing an
upgrade, a snapshot is helpful, allowing you to restore the prior system state if there are problems.
After a few days, the snapshot loses its value as a restore becomes increasingly unlikely because you
would lose the application changes as well. Snapshots also play a role in backups, where they are
used temporarily to provide the psuedo-consistent state for the backup utility before the snapshot is
deleted.
When a snapshot is deleted, that delta is applied to the base virtual disk(s), playing back through the
transactions. Large snapshots take a long time to delete and aect system performance until the
consolidation is complete. They can also aect the VM during normal operation as the delta le size
increases.

POSTED BY
RNELSON0
POSTED ON
APRIL 4, 2014
POSTED UNDER
POWERCLI
COMMENTS
LEAVE A COMMENT

PowerShell Profile
In an earlier article, I described how to create a PowerShell Prole, specically so that you could
access PowerCLI snapins in the regular PowerShell or PowerShell ISE programs where you get tab
completion and intellitype. However, it was buried in the midst of another article where it was hard
to nd.
The below PoSH will create a new prole if it doesnt exist and add the VMware snapins, then it will
open the prole le for editing. PowerShell and PowerShell ISE each have their own prole le, so
run it in both if you need to.
For PowerCLI version 5.5 and below, use:

14 of 17

14-08-2016 01:51

PowerCLI | rnelson0

https://rnelson0.com/category/powercli/

if (! (Test-Path $profile)) {
New-Item -Path $profile -Type file -Force
'Add-PSSnapin VMware.VimAutomation.Core -ea "SilentlyContinue"'
'Add-PSSnapin VMware.VimAutomation.Vds -ea "SilentlyContinue"'
'Add-PSSnapin VMware.VimAutomation.License -ea "SilentlyContinue"'
'Add-PSSnapin VMware.VimAutomation.Cloud -ea "SilentlyContinue"'
'Add-PSSnapin VMware.DeployAutomation -ea "SilentlyContinue"'
'Add-PSSnapin VMware.ImageBuilder -ea "SilentlyContinue"'
}
notepad $profile

|
|
|
|
|
|

Out-File
Out-File
Out-File
Out-File
Out-File
Out-File

-F
-F
-F
-F
-F
-F

For PowerCLI version 6, use this instead:


if (! (Test-Path $profile)) {
New-Item -Path $profile -Type file -Force
'Add-PSSnapin VMware.VimAutomation.Core -ea "SilentlyContinue"'
'Add-PSSnapin VMware.DeployAutomation -ea "SilentlyContinue"'
'Add-PSSnapin VMware.ImageBuilder -ea "SilentlyContinue"'
'Import-Module VMware.VimAutomation.Core'
'Import-Module VMware.VimAutomation.Vds'
'Import-Module VMware.VimAutomation.License'
}
notepad $profile

|
|
|
|
|
|

Out-File
Out-File
Out-File
Out-File
Out-File
Out-File

-File
-File
-File
-File
-File
-File

Verify the prole contents are correct (this should preserve existing proles, but check that new
content didnt merge at the end of the previous content). You can add any additional PoSH
commands, such as aliases, to your prole, then save the le. Restart Powershell (ISE). Your startup
will take a li le longer now, but you end up with tab completion, intellitype AND PowerCLI. If you
messed anything up, you should still have notepad open, just edit whats needed and restart the
PoSH shell till you get it right.

POSTED BY
RNELSON0
POSTED ON
APRIL 2, 2014
POSTED UNDER
GIT, POWERCLI
COMMENTS
1 COMMENT

15 of 17

14-08-2016 01:51

PowerCLI | rnelson0

https://rnelson0.com/category/powercli/

PowerCLI GitHub Repo March 2014 Updates


In March, I created my PowerCLI GitHub Repo (h ps://rnelson0.com/2014/03/12/powercli-githubrepo/) with just two cmdlets. By the end of March, I had many more cmdlets in the repo. Here are the
updates:

PowerCLI-Administrator-Cmdlets
Via h p://tenthirtyam.org/per-cluster-cpu-and-memory-utilization-and-capacity-metricswith-powercli/ (h p://tenthirtyam.org/per-cluster-cpu-and-memory-utilization-and-capacity-metricswith-powercli/) (@medavamshi (h ps://twi er.com/medavamshi)):
Get-ClusterStats A very detailed report on current Cluster resources and rough estimates of
resources available after 1 or 2 cluster member failures. Useful in predicting failure scenarios as
well as an eyeball view of capacity management.
Via h p://hostilecoding.blogspot.com/ (h p://hostilecoding.blogspot.com/) (@hostilecoding
(h ps://twi er.com/hostilecoding)):
Edit-v10VMs (h p://hostilecoding.blogspot.com/2014/03/vmware-powercli-gui-to-edit-vmhardware.html) An alternative GUI to vCenter that can edit VMs with vHW 10. Useful for those
without vCenter or who do not like the vSphere Web Client.
Via h p://myvirtualcloud.net/?p=5924 (h p://myvirtualcloud.net/?p=5924) (@StevenPoitras
(h ps://twi er.com/StevenPoitras) and @andreleibovici (h ps://twi er.com/andreleibovici)) are a
pair of cmdlets useful for stress-testing your storage (and vCenter, if youre not careful):
Clone-VM Spin up a specied number of clones of the named VM, using VAAI by default.
Unclone-VM Provide the name of the cloned VM and stop/delete all the clones.
Via h p://pelicanohintsandtips.wordpress.com/2014/03/13/creating-multiple-virtual-machineswith-powercli/ (h p://pelicanohintsandtips.wordpress.com/2014/03/13/creating-multiple-virtualmachines-with-powercli/) is a single cmdlet for Template deployments
Deploy-Template Use an existing Template and OSCustomizationSpec to deploy multiple
instances of a Template into a specied Datacenter/Folder with sequential IPs.

PowerCLI-User-Cmdlets
Via h p://www.shogan.co.uk/vmware/three-powercli-scripts-for-information-gatheringvms-hosts-etc/ (h p://www.shogan.co.uk/vmware/three-powercli-scripts-for-information-gatheringvms-hosts-etc/) (@shogan85 (h ps://twi er.com/shogan85)) come three cmdlets that all have the
option to output to CSV as well:

16 of 17

14-08-2016 01:51

PowerCLI | rnelson0

https://rnelson0.com/category/powercli/

Get-VMHostBIOSInfo Report on the Model and BIOS of all VMHosts a ached to your
connected vCenter.
Get-VMHostESXInfo Report on the ESX(i) version and build of all VMHosts a ached to your
connected vCenter.
Get-VMHardwareInfo Report on the vHW version of all VMs in a specied datacenter.
Via h p://hostilecoding.blogspot.com/ (h p://hostilecoding.blogspot.com/) (@hostilecoding
(h ps://twi er.com/hostilecoding)):
Get-VMConsoleGoogleChart (h p://hostilecoding.blogspot.com/2014/03/vmware-vm-stats-usingpowercli-and.html) Use Googles chart tools (h ps://developers.google.com/chart/) to graph
stats like mem.usage.average for all VMs on a VMHost.
rnelson0

17 of 17

Blog at WordPress.com.

14-08-2016 01:51

You might also like