Archive for December, 2009

Get me all groups I manage

Finding all AD groups someone owns is as easy as:

Get-QADGroup -ManagedBy 'Dmitry Sotnikov'

(Obviously put your name, sAMAccountName, DN, email address or another identifier instead of mine. πŸ˜‰ )

This is one of the nice little features added in QAD cmdlets 1.3.

One interesting modification of this cmdlet is to look for all groups owned by your reports:

Get-QADGroup -ManagedBy (Get-QADUser -Manager 'Dmitry Sotnikov')

Or with some output:

Get-QADGroup -ManagedBy (Get-QADUser -Manager 'Dmitry Sotnikov') | Format-Table Name, ManagedBy

Now you can see which groups maybe you should no longer manage, or find nice unused groups for some safe experiments. πŸ˜‰

Adding list of users to group

Say, you get an email asking to add a bunch of members to a distribution list you manage. What is the easiest way to do this? Going to Outlook, making 5 clicks to get to the dialog box, and then manually adding each user from the address book picker is definitely not fun. However, PowerShell definitely is.

I’ve seen people submitting lists of members to add in a couple of ways: separated by commas (or semicolons) or each on a separate line. Both would work fine – the only difference is how you would tell PowerShell to split this string into actual members’ names.

Let’s start with a comma-separated list. Like this:

Hey Dmitry,

Could you please add Kirk Munro, Darin Pendergraft, Oleg Shevnin to the PowerGUI DL?


All you need to do, is copy the part of the email with the names, use PowerShell -split operator to break it by comma characters, and pipe the result into Add-QADGroupMember:

'Kirk Munro, Darin Pendergraft, Oleg Shevnin' -split "," | Add-QADGroupMember PowerGUI

That is it!

Line by line option is not much different – you just have to split by newline character ("`n") instead of comma:

'Kirk Munro
Darin Pendergraft
Oleg Shevnin' -split "`n" | Add-QADGroupMember PowerGUI

And by the way, email addresses instead of user names are totally fine too:

',' -split "," | Add-QADGroupMember PowerGUI

One of those cases when command line is so much easier than UI. πŸ™‚

Hacking PowerGUI

Let’s talk about a few community efforts taking PowerGUI extensibility to the next level.

As a background, PowerGUI Admin Console was designed with extensibility in mind and has a notion of PowerPacks. Basically, the console is simply displaying and executing the PowerShell code supplied in the PowerPack add-ons you load. Kirk has created a great PowerPack step-by-step tutorial/reference, and shot a ten-minute screencast on that topic.

However, sometimes the native PowerPack management functionality we provide is not sufficient or we are not documenting what you can do fast enough. If you feel like that, I would highly recommend that you:

If you want to get the most out of your custom PowerGUI admin consoles – these efforts are well worth checking out and actually joining! PowerGUI is so successful because it is a community effort and you could help take it to the next level! πŸ˜‰

New PowerGUI Overview Video

New to PowerGUI admin console or script editor and debugger? Or just not sure whether you are up to speed with all the major functionality the product has?

Watch this video overview of all the key functionality the product has which Darin has just posted (full screen and HD recommended):

It is about 20 and takes you from basics to features such as graphical admin console, powerpacks, filtering, reporting, script editor, debugging, code snippets and online search. If you want to also see the table of content and be able to jump between the topic – use the version we posted here.

PowerGUI Survey

When do we stop supporting PowerShell 1.0 in newer releases of PowerGUI and switch to PowerShell 2.0 only? You can affect this by responding to the poll Darin put on the PowerGUI User Discussions forum:

The poll is in the right-hand column of the PowerGUI Discussion Forum

Please take a few seconds by answering one single question of the poll: when do you expect to have your administrative workstation upgraded to PowerShell 2.0. You need to log into to vote.

The poll is available at the right-hand column of the PowerGUI User Discussions forum.

You can also post your comments here or in this discussion thread.

Thank you in advance!

Winter PowerGUI Wallpaper is here

PowerGUI Wallpaper for Winter 2009/2010And it is the most beautiful one we have ever had! Just pick the size you need, apply it to your desktop and enjoy the upcoming holiday season:


Our downloads page also has links to the Christmas/New Year wallpaper we had last year, and for our friends in the Southern Hemisphere there a couple summer options! πŸ˜‰

Restructuring AD groups

Creating a subgroup and removing duplicate accounts from parent group is easy. I have just done this to one of the groups I manage (dev manager of one of the teams created a group for the team so I could include the group rather than individual members) and thought I would share the one-liner with you:

Compare-Object (Get-QADGroupMember MainGroup) (Get-QADGroupMember SubGroup) -ExcludeDifferent -IncludeEqual | Select -Expand InputObject | Remove-QADGroupMember MainGroup -WhatIf

Obviously, put your group names in there, and remove the -WhatIf if you want this command to actually change group membership.

The oneliner is pretty much self-explanatory:

  1. I first compare group membership of the two groups (using Compare-Object),
  2. Exclude the objects which are different and only retrieve the ones which are the same,
  3. Then I ask PowerShell to give me the actual objects (Select -Expand InputObject) – otherwise Compare-Object gives its wrappers with direction indicators and we do not need them here, and then
  4. Pipe these into the Remove-QADGroupMember command.

Very simple and saved me a few minutes today! Which I then used to write this blog post. πŸ˜‰

OR in AD cmdlets

Starting with version 1.3 you can make multiple queries in a single Get-QAD* call. This is possible because a lot of parameters now accept arrays.

So, if you are interested for example in all users from London or Seattle you can just do:

Get-QADUser -City 'London', 'Seattle'

Wildcards are also accepted:

Get-QADComputer -Name 'A*','B*'

You can nicely combine some of these with output from other cmdlets – e.g. to find all groups managed by users from your team:

Get-QADGroup -ManagedBy (Get-QADUser -Manager 'Dmitry Sotnikov')

And you can obviously keep using the old way of specifying just one value, and combine various parameters in one call. For example getting a list of your pre-sales and professional services employees from the West coast for a training could be as easy as:

Get-QADUser -Enabled -Office ('CA', 'OR', 'WA') -Department ('Pre-sales', 'PSO')

Full list of parameters which now accept arrays can be found on page 21 of the AD cmdlets Administrator’s Guide, and you can find full help information for any of the cmdlets in our online reference.

Hope this makes your AD administration even more enjoyable! πŸ˜‰

PowerGUI 1.9.6 Released

The most popular free PowerShell tool has just got even better! πŸ™‚ We have released version 1.9.6 of PowerGUI, and both the script IDE and the admin console got nice additions.

The script editor and debugger now has automated recovery. Basically we automatically save your work in our temporary files like Microsoft Office does (the frequency can by set in Options) and if for some reason you experience a crash or accidentally pull the plug from the wall or your kid presses that shutdown button – next time you start the editor your scripts will all be there!

In administrative console, we have improved custom deployment scenario – in which you want to deploy to your end users PowerGUI with specific set of PowerPacks and custom rebranded welcome screen. Now in addition to the silent install options, PowerGUI’s redirections.xml file (located for each user in %appdata%\Quest Software\PowerGUI) can contain paths (including UNC) to the welcome page (in MHT format) and any number of PowerPacks.

And obviously there is a significant number of smaller improvements and fixes for the issues reported by you on the community forums.

Download the new release now from the web site or wait for about a week till we push it through autoupdate.

Winners of PowerPack Challenge 2009

Susan has posted the resuls of the PowerGUI scripting contest we had last month and it was so intense that we ended up with 5 winners instead of 3!

So, without further ado… let me open this envelope… and announce that the winners are… πŸ˜‰

Most Active Participant ($1000 Amazon certificate) – Adam Murray – IIS7 Powerpack.

Second Most Active Participant ($500 Amazon certificate) – Shannon Ma – NetPoint PowerPack for Windows Management

Best PowerPack ($1000 Amazon certificate) – Alan Renouf – Virtu-Al.Net VMware Virtual Infrastructure / vSphere scripts

Honorable Mention and $250 Amazon certificates:

If you are one of the winners (congratulations!) you will get contacted shortly with details on how you will be able to get the prize.

The competition this year was increadibly intense and all the winning PowerPacks are just great and well worth checking out.

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

December 2009

%d bloggers like this: