Virtualization, Cloud, Infrastructure and all that stuff in-between

My ramblings on the stuff that holds it all together

Category Archives: PowerShell

Installing a PowerShell IDE on Windows Server 2008 R2

I’m sitting Thomas Lee’s PowerCamp espresso-powered PowerShell course this weekend – highly recommended, see my previous post.

I didn’t know this, being a POSH newbue, but there is a free, built-in PowerShell IDE, editor that ships with Windows Server 2008 R2, so for my labs I tend to install PowerGUI to bodge together some scripts.

Two lines of POSH and you can install the editor from PowerShell Smile rather than struggling with notepad.

import-module servermanager

Add-WindowsFeature PowerShell-ISE

It’s quite functional, and does the job Smile and it’s free/built-in.


There are other commercial editors if you need to do this on a more regular basis from your own workstation.

PowerCamp–weekend PowerShell Training Course

I came across this today on my Twitter feed, Thomas Lee is running a weekend course in PowerShell in London this April, the agenda is as follows..

What is A PowerShell PowerCamp?
This fast paced weekend event covers all the key aspects of Windows PowerShell – from the command line and writing production-oriented scripts. We start with the basics including installation and configuration, formatting and providers and remoting. We then look at scripting, managing script libraries using modules, using objects, and finishing with the PowerShell features added into Windows. We finish with a look at PowerShell in the cloud and what’s coming with PowerShell V3.

The PowerCamp event is all lecture plus Q&A, with the opportunity to type along with the tutor. There are no formal labs.

What is the Agenda?
Day 1 – The Basics
• PowerShell Fundamentals – starting with the key elements of PowerShell (Cmdlets, Objects and the Pipeline) plus installation, setup, and profiles
• Discovery – finding your way and learning how to discover more
• Formatting – how to format output nicely – both by default and using hash tables and display XML
• Remoting – working with remote systems using PowerShell’s remoting capabilities
• Providers – getting into OS data stores via PSProviders
Day 2 – Diving Deeper
• Scripting Concepts – automating everyday tasks including PowerShell’s language constructs, error handling and debugging (both from the command line and using an IDE)
• Modules – managing PowerShell script libraries in the enterprise
• .NET/WMI/COM Objects – working with native objects
• PowerShell and Windows Client/Server – how you can use built in PowerShell cmdlets
• PowerShell in Key Microsoft Servers – a look at PowerShell today in SQL, SCVMM plus a look forward to the future with SharePoint 2010
• PowerShell and the cloud – this module looks at PowerShell in the cloud and how you can use PowerShell to manage cloud computing.
• PowerShell V3 – this final module shows you what’s new in PowerShell V3.

I am planning to attend, the cost is £200; which is an absolute bargain IMHO, and especially so if (like me) you are a contractor and can do this over a weekend. I’ve attended a Microsoft deployment course taught my Thomas in the past and I can vouch that he’s an excellent instructor.

It looks like an excellent way for a relapsed coder like myself to get re-immersed, if you’re a frequent LonVMUG’er this is a good complement to Alan Renouf’s PowerCLI sessions.

For more info and the full agenda click here

Quick and Dirty PowerShell to create a large number of test VMs with sequential names


Be gentle, I’m new to this PowerShell stuff – I have a requirement to create a large number of VMs from a template, this is the PowerShell Code I hacked together from a VMTN communities blog post – it’s not pretty but it works for me – you can play with the variables to adjust to your own environment and desired number of VMs.

In my case my template is a Linux VM setup ready to boot from a LiveCD – just so it generates some basic load when it starts up.

There is a bit of clever number formatting which I lifted from this blog post to pad the VM numbers out to 3 digits and make it tidy looking, not entirely sure I understand what it does – but it works!

I am using PowerGUI based on the info at Al’s blog here

Connect-VIServer -Server localhost >$null

$NameVM ="vmNested-"
$NameTemplate ="TPL – vmNested-01"

$Date=get-date -uformat "%Y%m%d"

$NumArray = (1..$HOW_MANY_TO_CREATE)

foreach ($number in $numArray )
$name =  $seqn | % {"{0:0##}"          -f $_}
$string = $NameVM + $name
echo Creating $string
New-VM -template (Get-template $NameTemplate) -Name $string -Datastore (Get-datastore $Datastore) -VMHost $ESX


The Results (40 VM’s from template – completed in about 5mins);

image image