VMM Integration and Extension With PowerShell

This post is just some notes from a session, so it may seem, more than
other posts this week, a bit more disjointed and random:

Microsoft Virtual Machine Manager Integration and Extension

MS System Center VMM 2007 and System Center VMM 2008 (beta at this
time). (MS SCVMM)

You’ll need a background, understanding, or working-knowledge of
PowerShell. I don’t have any. Zip. Zero. Nada. Never even seen what
any commands look like.

PS looks much like a combination of VB, DOS, bash

VMM Admin Console acts as a front end for PS.

As an aside, prompted by a slide that was just up: can VMM manage ESX
3.5 hosts directly? Or does it require a Virtual Center front end for
ESX?

Another question: what utilities or commands are available on *nix to
manage RPC-capable services on Windows? Reboots, administrative
changes, etc.

If you use the wizard, you can grab its script. So, if we create a new
VM with “NewVM” as its name, we can change the script to allow us to
pick a name.

For example, add:

> $VMName = Read-Host -Prompt “VM Name”

to the top of the script then we can save it in the SC Library and
execute it again. It’ll prompt for a VM Name so ou can add it. Right-
click it to view, run, etc.

If a script isn’t signed, we’ll get a warning to not run, run once,
suspend, or get help. Pretty handy.

When run, the prompt is, as suggested by the syntax of the command
above, you’d see:
> VM Name:

VMM Object Model includes nouns and verbs. Nouns include VMM Server,
Host Group, Host, VM, Library. Verbs include things like Creator,
Owner, Name, Group, Add, Move, Start, Stop, etc — but may not be
available on every noun.

Organization of VM objects:

> VMM Server
> Host Group
> Host
> VM
> Drives
> NICs
> etc.
> Library
> Share
> VHD
> ISO
> VM

Every object in VMM is customizable with additional properties. So, we
could add an expiration date, last updated date, physical location (if
it’s a host, of course), etc. Whatever is required or desired.

Aside: PowerShell is, apparently, downloadable — I’ll see if I can
track down a URL. I guess an introduction or HowTo will be required,
too.

Aside #2: Presenter stated that he “used this pipe [character], which
is unique to PowerShell”. Um, I swear it’s been around for decades.
You see, the concept of the pipe is that it uses the output of the
previous command as input for the next command.

For example, in DOS, if you do just:
> ping -n 1 hostname.whatever.com
then a single ping will be sent to hostname.whatever.com followed by
some other statistical information. However, if I just want to see if
a reply was actually received, the line from the ping that confirms
that would contain the word “Reply”. So, we could change it to be:
> ping -n 1 hostname.whatever.com | find /i “reply”
Presto.

From looking at the demo, it’s very much like sh and its variants,
but uses the MS

> command noun verb

concept as opposed to sh (bash/ksh/tsh, etc) and DOS method of

> command option attribute

The concept is exactly the same though. You have a command, followed
by any number of appropriate options and attributes.

An example of a PS command progression to see all of the VM Hosts:
> get-vmhost
> get-vmhost | ft
> get-vmhost | | sort AvailableMemory | ConvertTo-Html Name,
> AvailableMemory, OverallStateString, VirtualizationPlatform -title
> “Current Host” | Set-Content hosts.htm

(will dump content as described to hosts.htm)

Not to point out the painfully obvious, but clearly, PS wants to be
Unix. They’re promoting console shells to replace all of the point/
click methods

PS is highly verbose. Verbosity is excellent for documentation, but
extremely time consuming (for me) as a scripting language. For
example, there’s an attribute that he used called:
> -RunAsynchronously
which runs the command in the background.

In *nix, we can do exactly the same thing by appending this to the end
of any shell command:
> ;

Just a semicolon. *nix admins are lazy. Then again, in *nix, we could
also Ctrl+Z the current command if it’s running in the foreground,
then type
> bg
to send it to the background.

There’s a GUI front end available for PowerShell: PowerGUI, a 3rd
party, for-fee application. No mention of price. PowerGUI is an
extension to PowerShell but also includes some of the command-
completion that you would find in bash (*nix) or even in VB/VBScript/
VBE. Still, it could speed the process for many users who are not
familiar with consoles.

PowerGadgets Creator allows you to create Vista desktop gadgets based
on PowerShell. Handy!


Posted from MS TechEd, 2008

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.