Category Archives: PowerShell

Correct HAL Installed ?

Following an inspiring blog post from Duncan Epping located here it made me think about how I could find the CPU vs HAL information, a 5 minute mess around in the VI Toolkit produced the following script:

Connect-viserver MYVISERVER

$myCol = @()

ForEach ($VM in (Get-VM)){
$MyDetails = “” | select-Object Name, HAL, NumvCPU
$MYDetails.Name = $VM.Name
$Hal = Get-WmiObject -ComputerName
$VM.Name -Query “SELECT * FROM Win32_PnPEntity where ClassGuid = ‘{4D36E966-E325-11CE-BFC1-08002BE10318}'” | Select Name
$MYDetails.HAL = $Hal.Name
$MYDetails.NumvCPU = $VM.NumCPU
$myCol += $MYDetails}

$myCol

This will give you a list of your VM’s the HAL installed and the number of vCPU’s

Special Edition: Get-Scripting Podcast

Jonathan has been busy at TechEd 2008 in Barcelona, we managed to get him hosting a PowerShell Panel discussion with some of the the top names in powershell, I highly recommend listening to the new episode…

Welcome to Episode 4 of the Get-Scripting podcast! Tune in to listen to us talk and interview people about Powershell.

This episode was recorded live on Tuesday 4th November at TechEd EMEA, Barcelona and features only the recorded Powershell Panel Discussion.

Please bear in mind that it was recorded in a large exhibition hall full of people, so there is a lot of background noise going on during the discussion – the content was so good I decided to get this out as I guess an ‘out of band’ episode and you never know I might even beat the Teched website for which it was also videoed.

A big thank you goes to PowershellCommunity.org for helping put this discussion panel together. We were joined by:

  • Ben Pearce – Microsoft
  • Richard Siddaway – Powershell MVP
  • Dmitry Sotnikov – Powershell MVP
  • James O’Neill – Microsoft
  • Tobias Weltner – Powershell MVP
  • Jeffrey Snover – Microsoft and Powershell Creator
  • Mow – Powershell MVP

Download the episode here

Free GUI builder tool for PowerShell


SAPIEN have just announced a free forms tool for PowerShell, now you can add a GUI to the amazing powershell scripts which you have been creating and make them easier for your colleagues to use.

Looks like all the normal form type controls ere there ready for you to drag and drop so why not download it now and start building an application…. Download here

To get started they have even given you an online beginners tutorial

TechEd 2008 PowerShell Panel Discussion

Good luck to Jonathan Medd, he’s up there with the big guys now !

There’s a correction to the TechEd EMEA (IT Forum) PowerShell agenda. Tomorrow (Tuesday, Nov 4) 2-3 pm there will a PowerShell Panel Discussion on a stage adjacent to the Tech´Talk Fishbowl.

This is not in your conference agenda books so please take your pen and add it in yourself!

The invited speakers include:

  • Jeffrey Snover
  • MoW
  • Richard Siddaway
  • James O’Neill
  • Jonathan Medd
  • Dmitry Sotnikov

It’s going to be fun, so make sure you come and join us in this open panel discussion!

http://dmitrysotnikov.wordpress.com/2008/11/03/powershell-panel-it-forum/

Powershell Audit Script


Time for my first stab at WMI, I have just completed my audit script which will give you a nice html audit of each of the computers in a file or if run with no parameters and it will use localhost.

This is a conversion of an old vbscript which I have been using for a while, updated and enhanced and very much quicker !

Usage: Audit.ps1 ‘c:\servers.txt‘ or just run Audit.ps1 with no parameters to audit the localhost.

The txt file must consist of each server on an individual line.

Best viewed in IE but will work in firefox (minus the expanding of cells)

As always your comments are welcome.

Powershell Email Locks attachment

I came across an issue when I was trying to manipulate a file which I had just emailed using the standard email code which is on multiple places on the web.

All descriptions on the web (that I have seen) which show how to do this so far have left the email attachment open which means if the script is continuing after the email and you wish to use the file you have attached you will not be able to as it will show as locked, use this example to close the attached file correctly using .Dispose()

Thanks to Jaykul on the Powershell IRC channel.

Powershell Citrix License Alerts

We had an issue today where we ran out of Citrix Licenses and therefore some of the users were unable to login, the Citrix License server seems to be a pretty basic app with alerting feature.

After purchasing and installing some licenses so that the users could gain access to there applications again we started thinking about ways to monitor this so it didn’t happen again.

I was sure we could monitor this using powershell and started to look into it, first thing I came across was a BSonPoSH article explaining how to get license information from WMI, that guy has done some impressive stuff with Citrix and powershell, check it out on his site.

Ok, so all looked fine and dandy, until we ran it and found that one of our licenses was not showing in the figures 🙁

Looking into it a bit more and exploring WMI gave us the same results, one of the licenses was missing. Sod’s law says it was the one we were after too !

Looking on the Internet again it would seem this is a “known problem” which there is a private fix for.

Not to be beaten I thought of other ways to get this information, I know I had pulled information from websites before so decided to try and access the information direct from the license web page.

Looking at the html code that was dumped, it was changing, this made it hard to just read the specific lines I wanted, so as you can see from the code I searched for the license type I wanted ‘Enterprise’ and then worked out where the figures are that I needed from there.

If nothing, this is a useful script to see how to retrieve html information and work with it to get the end results.

Run it normally and if the License usage is above 90% it will fire off an email or run it with the send parameter to send an email anyway.

Any comments or quires please leave a comment below.

Download the script here