Virtual Strategy Magazine – Top 10 PowerShell scripts that VMware administrators should use

 PowerShell, VI Toolkit, VMware  Kommentare deaktiviert für Virtual Strategy Magazine – Top 10 PowerShell scripts that VMware administrators should use
Jan 152009
 

Virtual Strategy Magazine – Top 10 PowerShell scripts that VMware administrators should use

PowerShell
is an extensible command-line shell and associated scripting language developed
by Microsoft that can be used to help automate common administration tasks and
also provide information about your VMware environment. PowerShell can be used
for many different things in Windows environments but can also be used with
VMware environments since VMware released their VI Toolkit which provides
PowerShell with access to the VMware API. Scripting is a great way to make up
for a product’s shortcomings or missing features and can be a real time saver
for administrators. Consequently many systems administrators learn a bit of
scripting and write their own scripts to make their job easier. PowerShell is
fairly easy to install and use and there are many great scripts that have been
written that work with VMware environments. This list consists of some great
scripts that have been written by many different individuals that help automate
and report on VMware environments.

 
 

1

Quick Migration

http://mikedatl.typepad.com/mikedvirtualization/2008/10/quick-migration.html

A script from Mike DePetrillo that duplicates
the Quick Migration of HyperV in a VMware environment by suspending a running
VM and moving it to another ESX host server.

 
 
 

2

Report into MS Word

http://communities.vmware.com/docs/DOC-7070

A script from Alan Renouf that provides a
report in Microsoft Word of the virtual machines in your environment with
graphs and pie charts.

   

3

Dynamic Resource Pool Calculator

http://communities.vmware.com/docs/DOC-6970

A script from Eric Sloof that recalculates
all of your resource pools and can automatically increase memory and CPU
reservations. It can be run interactively using a GUI or through a command line
with arguments.

   

4

VMware Infrastructure Power Documenter

http://communities.vmware.com/docs/DOC-7473

A script from Antonio Zamora that produces
many different detailed reports about your VMware environment in Open XML
format.

   

5

ESX Automated Configuration Midwife

http://communities.vmware.com/docs/DOC-7511

A script from Lance
Berc that adds a new ESX host to VirtualCenter and configures networking,
storage, VMotion and a few other things.

   

6

VMware Health Check script

http://communities.vmware.com/docs/DOC-7430

A script that produces a report of your
VMware environment including information on snapshots, datastores, VMware tools
versions, mapped CD-ROM drives and more.

   

7

Track Datastore Free Space

http://www.peetersonline.nl/index.php/vmware/track-datastore-free-space/

A script from Hugo Peeters that produce
reports that track free space on your datastores so you can see how it changes
over time.

   

8

List disk RDMS

http://communities.vmware.com/message/1063909

A script that lists any Raw Device
Mappings (RDMs) that exist in your environment which is helpful as RDM’s are
not listed in the datastore list of ESX servers.

   

9

Find snapshots and send email to
user/users with

http://communities.vmware.com/docs/DOC-6980

A script from Chris Uys that emails a
report of snapshots that are running in your VMware environment.

   

10

Setting Video Hardware Acceleration Level

http://www.peetersonline.nl/index.php/vmware/setting-video-hardware-acceleration-level/

A script from Hugo Peeters that sets the
video hardware acceleration level inside Windows VMs to Full so they perform properly
in a VMware environment.

 

, , , ,

 Posted by at 14:27

Tons of new stuff in the VI Toolkit Community Extensions

 PowerShell, VI Toolkit, VMware  Kommentare deaktiviert für Tons of new stuff in the VI Toolkit Community Extensions
Jan 152009
 

Thanks to none other than Mr. Luc Dekens the VI Toolkit Community Extensions are growing by leaps and bounds.

Here’s a full list of the new advanced functions Luc has added:

Name Description
Get-TkeAllPrivileges Show all privileges defined by VirtualCenter.
Get-TkeCDPInfo Gets Cisco CDP info for a given host.
This lets you know what switch port your host is on.
Get-TkePermissions Lists permissions assigned to a given object.
Get-TkeRolePrivileges Show all privileges defined by a role.
Get-TkeRoles Gets all roles defined in VirtualCenter
For example, Administrator, Read-Only, etc.
New-TkeRole Create a new role in VirtualCenter.
Remove-TkePermissions Remove permissions from an entity.
Remove-TkeRole Remove a role from the system.
Set-TkePermissions Set an entity’s permissions.
Set-TkeRole Change the definition of a role.

As you can see most of these are around roles and permissions. Armed
with these cmdlets you have a pretty complete way to automate the setup
of permissions.

The other cmdlet is Get-TkeCDPInfo. CDP stands for Cisco Discovery
Protocol, and if your ESX host is connected to a switch port that
supports CDP, this cmdlet will help you determine what switch port the
system is actually connected to.

Also, the VI Toolkit Community Extensions have been updated to
support the newly-release PowerShell CTP3. One of the big differences
between CTP2 and CTP3 is that script cmdlets are no longer supported,
instead they have been replaced by Advanced Functions. Advanced
Functions have a number of advantages over script cmdlets, one of the
most obvious is support for embedding documentation in the function. If
you load the community extensions and type „help Get-TkeCDPInfo“ you’ll
get a full usage listing as well as other help to get you started. All
in all, this stuff is starting to get a lot more usable.

If you can’t wait to get started, be sure you have CTP3 installed and download the Community Extensions today!

Great work, Luc!

VIA: http://blogs.vmware.com/vipowershell/2008/12/tons-of-new-stuff-in-the-vi-toolkit-community-extensions.html

, ,

 Posted by at 10:22

New in the VI Toolkit Community Extensions: Set virtual switch security.

 PowerShell, VI Toolkit, VMware  Kommentare deaktiviert für New in the VI Toolkit Community Extensions: Set virtual switch security.
Jan 152009
 

While
we all eagerly await CTP3 of PowerShell Version 2 I wanted to mention
that I’m a big fan of PowerShell Version 2’s modules and script cmdlets
because combining these technologies makes it possible to build large,
cohesive and really useful management modules even if you’re not a
developer.

Glenn Sizemore has written just such a script cmdlet that lets you
set the security properties of virtual switches. With his cmdlet you
can configure whether virtual switches allow virtual machines on the
switch to see traffic to and from other virtual machines using the
-AllowPromiscuous flag. With the -ForgedTransmits flag you can
configure whether VMs are allowed to send packets using a different
source MAC address from the VM’s real MAC address, and with the
-MacChanges flag set, VMs on the switch can change their MAC addresses.

These options can be useful for enabling security-related
applications, for instance if you want to run an intrusion detection
virtual appliance on a virtual switch you’ll need to set
-AllowPromiscuous on the switch. The default is to have
AllowPromiscuous disabled while ForgedTransmits and MacChanges are
enabled, which is pretty much what you get with a real unmanaged switch.

Glenn’s cmdlet makes changing things really easy. You can see Glenn’s original cmdlet,
but note that the name and parameters are changed a bit in the
community extensions, to make it fit a bit more with other aspects of
the extensions. Here’s a quick example of the new cmdlets in action:

1 # List all my virtual switches and their security properties.
2 Get-VMHost | Get-TkeVSwitchSecurity
3 # Enable Promiscuous Mode on vSwitch1 on all ESX hosts in cluster SQL
4 Get-Cluster SQL | Get-VMHost | Set-TkeVSwitchSecurity vswitch1 -AllowPromiscuous

The VI Toolkit Extensions is now up to 30cmdlets that cover a wide
range of really useful stuff. If you’re looking to get started with the
VI Toolkit Community Extensions, Eric Sloof has a great writeup on how to do just that.
As PowerShell v2 nears official release, we’ve got some things planned
to make the VI Toolkit Extensions amazingly easy to use, for now it’s a
bit primitive but gets the job done.

Via: http://blogs.vmware.com/vipowershell/2008/12/new-in-the-vi-toolkit-community-extensions-set-virtual-switch-security.html

, , ,

 Posted by at 10:17