Archive for August, 2009

Introduction to PowerShell v2

Check out this video to learn how to start using the most important new features of PowerShell 2.0 including background jobs, modules, advanced functions, and function help (HQ and full screen recommended):

Great job by Kirk Munro! I know I will be now using these features a lot more.

Tags: , , , , , ,

Active Directory and CSV files

Here’s a new quick tip from Darin on AD exports and imports from within PowerGUI:

As usual, short and to the point.

Using CSV and text files in PowerGUI when managing AD is quite common. For example, I have seen people adding script node like:

Get-Content '\\server\share\users.txt' | Get-QADUser

If users.txt has a bunch of usernames (one per line) this outputs actual user accounts to the PowerGUI grid, which you can then manage with all the actions (disable, reset passwords, and so on.)

Alternatively, some customers are just using


in a node and then define some actions to perform various activities based on the fields in the grid.

Also, although Darin did not show that, you can create your own export to CSV and use something like

Select Name, samAccountName | Export-Csv

to pick specific columns to be exported.

And there’s whole update from CSV scenario… Man, I could go on and on with these! ๐Ÿ™‚

Tags: , , , , , ,

What was that group again?

A simple one-liner can help. Just earlier today I could not remember the name of a particular distribution list but knew a couple of its members. The quick one-liner to help me out was:

Get-QADGroup -ContainsMember ('User A', 'User B')

And while we are on it, here’s an even better one-liner if you want to find a DL which has all direct reports of, say, your company’s VP:

Get-QADGroup -ContainsMember (Get-QADUser -Manager 'User C')

And obviously if such a DL does not exist, you should probably just go ahead and create it ๐Ÿ˜‰

New-QADGroup -Name 'Top Managers' -Member (Get-QADUser -Manager 'User C')

I love PowerShell. ๐Ÿ™‚

Tags: , , , , ,

PowerGUI versus iTunes

Vote for your favorite PowerShell tool!

Windows IT Pro and SQL Server Magazine are holding their 2009 Community Choice Awards, and PowerGUI is nominated. Please select PowerGUI in 32. Best Free or Open Source IT Tool category and type it in 25. Best Scripting Tool:


It is pretty funny how the magazine moved all free and open source products from their original categories (e.g. Best Scripting Tool) and moved them into one huge free and open source one. Please support us but not only selecting us against iTunes and others ๐Ÿ˜‰ but also typing in PowerGUI and Quest AD cmdlets into other relevant categories. There will be a random prize drawing to win a $250 cash gift card or one of 30 Windows IT Pro T-shirts to compensate for your efforts. ๐Ÿ™‚

The vote is open here.

Help us design better PowerGUI lockdown

PowerGUI Admin Console has the ability to lock down the user interface so you can create custom management consoles specific to job roles (e.g. helpdesk), get these pushed to the corresponding users, and hide from them the functionality which might hurt them (e.g. ability to see the PowerShell code behind the functionality or change anything in the tool.)

See a quick video on the feature here and a related one here.

We want to make it easier to use in the future. So the question is: how granular you want lockdown to be? It can be all the way from item-level (let this user change this node but not the other one) to PowerPack-level to user-level.

I personally like the user-level approach – some people get more functional PowerGUI than others more read-only ones. E.g. if according to your job role you are supposed to be only using PowerPacks from others – you get a locked down version of PowerGUI – regardless of the PowerPacks assigned to you. On the other hand, if you are allowed to change PowerPacks – you can do this. Of course, you might not be able to post your changes to a central distribution point (file share or SharePoint site) but this is a whole different story.

Does this make sense?

Please put your comments to this blog entry and respond to the survey here.

AD Recycle Bin management console

Windows Server 2008 R2 ships with a great new object undelete feature – Active Directory Recycle Bin. The only problem with this feature (apart from requiring 2008 R2 functional level ;)) is that PowerShell command-line is the only management interface shipped for the feature.

Well, not anymore. Check out the free GUI Kirk has put together with PowerGUI (make sure you click the HD button when watching this and make it full screen):

It keeps amazing me how great PowerGUI is when you need such GUIs on top of anything exposing PowerShell.

Read more about the PowerPack in Kirk’s blog.

Download the PowerPack here.

PowerGUI and Modules

With full PowerShell v2, Windows 7, and Windows Server 2008 R2 support in PowerGUI we obviously absolutely had to fully support Modules – and we do. ๐Ÿ™‚ Modules are first class citizens in PowerGUI 1.9: you can add them, get intellisense and F1 help in script editor, start searching for them when adding admin console elements, set them as PowerPack dependencies and so on.

As a quick 101: modules are a new format of PowerShell libraries introduced in PowerShell version 2. Unlike snapins in v1, modules can be scripted – so you do not have to use Visual Studio and compile them.

To create a simple module, just take a PowerShell script file with a function, e.g.:

function Add-Number {
param ($A, $B)

Then create a folder with a name you want for a module (e.g. MATH) and save the file into that folder as MATH.psm1.

To make this module listed as available, put the module folder (in our example MATH) into one of the $env:psmodulepath folders. Which basically means C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ if you want it to be available to anyone, or your Documents\WindowsPowerShell\Modules if it’s for you only.

Now, if in PowerGUI (admin console or script editor) you click File / PowerShell Libraries, you’ll see it listed as one of the options:


As you can see, other modules (BitsTransfer and PSDiagnostics) are also available, as well as v1-style snapins.

You can also use Add Module button, if you want to add a module which you have outside of the default module folders.

Anyways, once you select MATH and click OK, the module becomes available for you. E.g. you get intellisense and F1 help for the module members:


For more information of creating modules of your own, see this MSDN page.

Happy PowerShell v2 scripting! ๐Ÿ˜‰

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

August 2009
« Jul   Sep »

%d bloggers like this: