Tuesday, 23 September 2008

Get-Scripting Podcast Episode 2 - (If you don't learn Powershell, tomorrow you'll be serving fries in McDonalds)

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

Download it here, subscribe in iTunes or via a different feed reader.

In this episode we have an interview with Thorbjörn Sjövold CTO of Special Operations Software.

Blog note links:

Ways to learn Powershell:

Windows Powershell Cookbook - Lee Holmes.

Powerscripting Podcast - Check out their back catalogue if you are new to Powershell, there is a lot of great content for you. Recent interviews include Jeffery Snover, Jeffery Hicks......upcoming is an interview with Don Jones and Greg Shields.


Special Operations Software

New version of Gpupdate based on Powershell

Specops Command - Powershell remoting through Group Policy

Other Specops products we talked about

Scandinavian Powershell Usergroup

Favourite cmdlets


Eureka Scripts

Jon Noble - Setting AD logon hours in Powershell, or "How to disable an AD user account and still allow delivery to the Exchange mailbox"

Dmitry Sotnikov - Setting Demo AD environments

Favourite Cmdlets

Send us what your favourite cmdlet is and why, and we'll enter you into the prize draw for Specops USB Pens and Mug.

get [dash] scripting [at] hotmail [dot] co [dot] uk


Send us feedback at

get [dash] scripting [at] hotmail [dot] co [dot] uk

or leave a comment here on the blog

Wednesday, 10 September 2008

Exchange 2003, WMI, AD and Powershell - Part 5 (Querying AD for Exchange 2003 Information)

In previous posts in this series we have looked in particular at some of the Exchange 2003 WMI classes. So far this has required manual specification of which Exchange server you want to retrieve info from; wouldn't it be nice if you could use Powershell to find all the Exchange 2003 servers in your environment then run the WMI query against the results? Fortunately for us Exchange 2003 stores a lot of configuration information in Active Directory so we can query AD to retrieve what we need. There is a great article here which details how you can do this. We do the following:

Create a new directory object using .Net for the current AD domain.

$root= New-Object System.DirectoryServices.DirectoryEntry("LDAP://RootDSE")

Use ADSI to get the configuration partition of AD.

$cfgNC = [adsi]("LDAP://" + $root.Get("configurationNamingContext"))

Create a directory search object

$search = New-Object System.DirectoryServices.DirectorySearcher($cfgNC)

Filter on the Exchange Server object class - the below image should help illustrate what we are doing here. (other classes you can search on can be found here)

$search.filter = '(objectclass=msExchExchangeServer)'

Use the FindAll method to execute the search.

$ExchServer = $search.FindAll()

Finally, return the names of all the results.

$ExchServer | foreach {$_.properties.name}

Which in the example from the screenshot would produce a result:


You can now combine this with any of the previous WMI scripts to run them against all the Exchange servers in your environment, e.g. for Top 10 largest mailboxes on each server:

$root= New-Object System.DirectoryServices.DirectoryEntry("LDAP://RootDSE")
$cfgNC = [adsi]("LDAP://" + $root.Get("configurationNamingContext"))
$search = New-Object System.DirectoryServices.DirectorySearcher($cfgNC)
$search.filter = '(objectclass=msExchExchangeServer)'
$ExchServer = $search.FindAll()

foreach ($server in $ExchServer)
$ExchangeServers = $ExchangeServers + $ExchServer | foreach {$_.properties.name}
foreach ($computer in $ExchangeServers) {
Get-Wmiobject -namespace root\MicrosoftExchangeV2 -class Exchange_Mailbox -computer $computer | sort-object Size -Descending | select-object -First 10 MailboxDisplayName,Servername,StorageGroupName,StoreName,Size}

Wednesday, 3 September 2008

IKEA, Bjorn Borg, Henrik Larsson, Powershell.........the Get-Scripting Podcast heads to Sweden.

In the interests of audio quality (ok so they have invited me over and are funding the trip) I'll be interviewing the great guys at Special Operations Software in person in Stockholm for Episode 2 of the podcast. If there's anything you always wanted to ask them then let me know.

Coinciding with the visit they are helping to run a Powershell event at Microsoft in Sweden. This will be a great event to attend if you are in the area and / or able to make it there since Richard Siddaway from the UK Powershell user group will be presenting the event.

In case you can't speak Swedish, in the morning is an official Technet event (sign up here) and in the afternoon is the inaugural meeting of the Swedish / Nordic Powershell usergroup.

Update 10/09/08: the Scandanavian Powershell Usergroup now has a website!

Since I'll be in town for the interview I'll be tagging along to the event, hopefully I might bump into some of the listeners to the podcast there - if you are going please say hello if you see me. I'll be the other English guy there who isn't at the front of the room. :-)