Archive for the 'Exchange' Category

Exchange 14 PowerGUI wallpaper

Oz (Exchange MVP doing a great series of Exchange/PowerShell/PowerGUI How-To’s) has also posted a bunch of Exchange 2010 desktop wallpapers – one of them featuring PowerGUI.

Download them here.

Tags: , , ,

Blog series on PowerGUI, PowerShell and Exchange 2007

Oz is doing a great series on managing Exchange 2007 with PowerShell and PowerGUI. Within last week he has posted quite a few really useful scripts which should be in every Exchange administrator’s toolbox – check them out:

And Oz still keeps doing this almost every single day! So please go to the blog and subscribe to the updates! 🙂

Tags: , , ,

Exchange 2003 PowerGUI webcast

Darin has posted the webcast he did with Jonathan Medd some time ago to the documentation page (second item in the Videos and Flash Demos section).

It’s a fascinating 15 minute interview featuring a demo of how PowerGUI and PowerShell can be used to manage Exchange 2003. Check it out here.

Tags: , , , , ,

Evan Dodds to present at TEC 2009

Evan Dodds, Senior Program Manager, Microsoft Just saw that Evan Dodds is on the Exchange track agenda with his Microsoft Windows PowerShell Scripting for Microsoft Exchange Server session.

Evan’s session are must-attend if you are managing Exchange and are interested in PowerShell. He is extremely knowledgeable (no surprise here – he is one of the key guys designing Exchange PowerShell implementation ;)) and just a great speaker.

This is in addition to a few other PowerShell sessions at TEC which I reported earlier.

Registration and more details can obviously be found at the conference web site.

Tags: , , , ,

PowerShell at DEC 2009

Looks like agenda for DEC 2009 (March 22-25) is almost settled by now – and it does have a few PowerShell sessions in there: Darren Mar-Elia (who gave the PowerShell world GPO management!) and Brian Desmond (another well-known AD MVP) are both going to present various tips and tricks on AD management with PowerShell.

I love DEC (DEC 2007 was one of the first conferences where AD cmdlets were first demoed by Richard in his PowerShell talk). If you are in AD/Identity Management world this is the conference to attend. The content is very deep and the peers you meet are very knowledgeable. Just check out the speaker line-up and the agenda so far.

This year they are also adding a whole new subconference on Exchange and messaging – hence the name change from DEC to TEC – which means more agenda conflicts if you are into both. 😉 Rob Allen is giving a PowerShell talk over there.

For those of us preferring Berlin to Vegas – there’s TEC Europe in September (obviously next September).

The early bird discounts seem to still apply. Register now and see you at the event!

Tags: , , , , , ,

Connect-Service for Exchange cmdlets?

Is it just me or is there no cmdlet similar to Connect-QADService for Exchange 2007?

My workstation is not in the forest which has the Exchange organization which I need to manage. Does that mean I now need to add the -Credential $mycreds -DomainController my.domain.local for each and every Exchange cmdlet instead of just connecting once and then working against a specific DC under certian credentials?..

Tags: ,

Exchange 2003 PowerPack!

Did you know you can do that much with PowerShell on Exchange 2003?

Did you know you could do that much with PowerShell on Exchange 2003?

We all kind of knew that Exchange 2000 and 2003 can be managed with PowerShell via WMI or AD but Jonathan Medd has just taken this to the whole new level!

His powerpack for Exchange 2003 has 53 (!) different nodes/links/actions exposing features ranging from mailbox and server management to address books and message queues.

And because this is a PowerGUI pack, you can see all the PowerShell code behind each and every item by just clicking the PowerShell Code tab, or even tweak the things a bit by going into the Properties.

This is a great piece of work obviously making Jonathan the front-runner of the PowerPack Challenge 2008 (you obviously have 2 weeks ahead to challenge this ;))

Check out the Exchange 2003 PowerPack and please let Jonathan know what you think.

Tags: , , , ,

Find and fix broken inheritance

Broken permissions inheritance can be a source of multiple issues – with PowerShell you can get such issues located and fixed with an easy oneliner.

Getting security inheritance blocked is easy – locating and setting it back can be hard. One big customer of ours once had most of their mail transport paralyzed with a branch administrator clearing the inherit permissions checkbox he thought should not have been there. Nicolas is reporting similar issues with Exchange 2007 deployments.

Seeing whether an AD object has permissions inheritance blocked is as easy as checking the object’s DirectoryEntry.psbase.ObjectSecurity.AreAccessRulesProtected property.

So for example, to get a list of all users in the domain who has inheritance off you just need to run:

Get-QADUser -SizeLimit 0 | where {$_.DirectoryEntry.psbase.ObjectSecurity.AreAccessRulesProtected}

I am using -SizeLimit 0 so I retrieve all users and not just the default 1000.

Fixing inheritance is even easier with the new Set-QADObjectSecurity cmdlet introduced in AD cmdlets 1.1.

So if you want to fix inheritance for all AD users (caution: you might want to just get the list of the accounts first using the command above to make sure you do not “fix” legitimate exceptions) you just need to pipe the collection into Set-QADObjectSecurity -UnlockInheritance:

Get-QADUser -SizeLimit 0 | where {$_.DirectoryEntry.psbase.ObjectSecurity.AreAccessRulesProtected} | Set-QADObjectSecurity -UnlockInheritance


Tags: , , , , , , , , , ,

Monitor web-site availability

Did you know that you can use PowerShell to monitor your website and send you alarms when something goes wrong? We had availability issues with our community site and I was quite surprised that the 20-line (!) PowerShell script did the job!

Basically, all I had to do was use the Net.WebClient object and its DownloadString method to query the page (with some proxy handling code I got from Alexey Chuikov), and trap any exception which it generates when something goes wrong. The trap is using our internal relay server to send me and everyone who is involved in the site administration the email.

Here’s the code:

# Test-Site - script to test web site availability
# and notify in case of any issues
# (c) Dmitry Sotnikov

function Test-Site {
        "Failed. Details: $($_.Exception)"
        $emailFrom = ""
        # Use commas for multiple addresses
        $emailTo = ","
        $subject = " down"
        $body = "PowerGUI web site is down. Details: $($_.Exception)"
        $smtpServer = ""
        $smtp = new-object Net.Mail.SmtpClient($smtpServer)
        $smtp.Send($emailFrom, $emailTo, $subject, $body)    
        exit 1
    $webclient = New-Object Net.WebClient
    # The next 5 lines are required if your network has a proxy server
    $webclient.Credentials = [System.Net.CredentialCache]::DefaultCredentials
    if($webclient.Proxy -ne $null)     {
        $webclient.Proxy.Credentials = `
    # This is the main call
    $webclient.DownloadString($URL) | Out-Null

Test-Site ""

To test it you can obviously just put an invalid URL into the call.

Once I had the script running, I just set up a scheduled task in Windows Task Scheduler to run the script every 15 minutes:
Windows Task Scheduler with a PowerShell task

One trick I learned from MoW and used in the task, was using the -command parameter (rather than just supplying the script) and including the exit $LASTEXITCODE into the command, so the exit code from the PowerShell script gets registered as the scheduled task result.

So here’s the command-line I have scheduled:

c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Noninteractive -command ". c:\scripts\test-site.ps1; exit $LASTEXITCODE"

Works flawlessly! And can save you tons of money on a monitoring solution. Talk about ROI from learning PowerShell! 😉

Tags: , , , , , , , ,

PowerShell Adoption by Platform

I have always wondered how much is PowerShell adopted across various administrative tasks. Now I finally found the stats.
Windows Server and Active Directory are far ahead, with Windows Desktop being a runner-up, Exchange on distant 3rd and everything else far behind.

PowerShell use survey statistics by application and platform

My take on the data:

  • Server and AD management tasks are far ahead of everything else. Too bad the survey didn’t distinguish between the two.
  • It is a bit surprising the desktops took number 2. My guess is that respondents just meant using PowerShell on their desktop for their personal needs. Despite existing 3rd-party solutions I doubt PowerShell v1 can be used that widely for mass desktop management. I think we will need to wait for v2 and remoting to see this taking off.
  • Not surprisingly almost a 3rd of respondents are not using PowerShell for admin tasks at all. After all, there is some learning curve involved here and PowerShell is not yet available for any platform.
  • Almost a quarter of PowerShell users employ it for Exchange 2007. A very good result! After all, Exchange 2007 was released not that long ago, and has just got its SP1.
  • In general, it looks like platforms with no cmdlets available don’t really get PowerShell fans. .NET can be used to manage SQL and SharePoint – but look how much behind are they! Exchange 2003 can actually be managed with PowerShell, but there are no native cmdlets built-in – and as result PowerShell use is just 1.5%. Compare that to 23.4% Exchange 2007 got!
  • I wonder why Operations Manager is relatively low. Less adopted than Exchange 2007? OpsMgr admins less willing to script? OpsMgr tasks not really requiring scripting and command-line use?

The survey was carried out by Quest Software and took place in the very end of December 2007 and early January 2008. It was promoted at, this blog, and a few other PowerShell blogs. About 200 people responded. The exact question was: “Select the systems you are currently managing with Windows PowerShell“.

Tags: , , , , , , ,

My Recent Tweets


The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

June 2021

%d bloggers like this: