PowerShell Ezine, Logon Scripts

Ezine 159 - PowerShell, PowerGUI and QaD

Ezine 159 - PowerShell, PowerGUI and QaDPowerGui and QaD

PowerGUI, as the name suggests, provides a graphical method for scripting with PowerShell.  The idea is to control your operating system by clicking on menus with the mouse, rather than typing commands in a shell.  What QaD does is provide extra 'handles' for PowerShell to manipulate Active Directory objects.

As you read this article, please keep in mind two points; firstly I have no connection with PowerGUI or QaD, secondly, these utilities are available as free downloads.

Topics for PowerShell, PowerGUI and QaD

This Week's Secret

I wish that I was more ambidextrous.  Heavy duty mouse work causes the fingers on my right hand to ache; when this happens I switch the mouse to my left hand.  Swapping the mouse between hands leads me to think of PowerGUI; the link is the way this utility encourages 'ambidextrous scripting'.  What I mean is with this free utility you can click on objects in the GUI with the mouse, or else you can switch to the command line and manipulate the same objects with instructions from the keyboard.

To digress, I wonder whether ambidexterity is prized in American sports.  We Brits try and kick the ball with either foot in both rugby and soccer, and we certainly try to catch with either hand in cricket.  Yet in baseball, or NFL there does not seem the same need for using the 'other' hand.

PowerGUI reminds me of ambidexterity because people fall into two main camps; those dexter (right-handed) types, who operate only with a mouse inside a GUI, and those sinister (left-handed) types, who use only the keyboard inside the dark world of the command-line shell.  Now, if you master PowerGUI you are going to employ both GUI and shell and thus enter the world of 'ambidextrous scripting'.

Benefits of PowerGUI

Ah yes, the benefits.  With PowerGUI beginners can create complicated scripts with little knowledge of the underlying PowerShell commands.  Yet, I think it's the intermediate scripters who benefit the most from getting the free PowerGUI.  They know enough to make sense of the code, moreover, they are curious enough to add their own extra commands.  Gradually, intermediates find that adapting a PowerGUI script at the command line is faster than repeating the more laborious steps of clicking in the GUI to create another 'Filter'.  In no time at all, intermediates develop into experts, or would that be, expert into developers!

Killer Reason to Get QaD Snap-ins

QaD (Quest Active Directory) snap-ins are a very useful in their own right.  The reason for downloading these free QaD snap-ins, with their cmdlets, is because PowerShell has so few native Active Directory commands.  Also keep in mind that PowerGUI can script files as well domain objects.  My point is when you bring PowerGUI and QaD snap-ins together, the whole is greater than the two halves. 

This Week's Mission - Ambidextrous Scripting

Persuading people to try PowerGUI is a classic example of my main role, getting people started with PowerShell.  Describing PowerGUI is easy because this is such an intuitive, and well designed package.  My hardest task is convincing you to take action and actually download and install PowerGUI and also QaD.  Hopefully, even that won't be too difficult.

This concept of 'ambidextrous scripting' also complements my master plan of using the GUI to learn about PowerShell, and scripting with PowerShell to control what you see in Windows Explorer or Active Directory Users and Computers.

Download PowerGUI and QaD Snap-ins from these sites:

Finding the correct site is a no-brainer for some, easy when you have been there once; tricky for the complete beginner.  Here are the URLs:

http://www.quest.com/activeroles-server/arms.aspx

http://powergui.org/index.jspa

Getting started with PowerGUI

Pre-requisite.  You have already downloaded PowerShell from Microsoft's site, and installed it.

Installing PowerGUI is easy - Guy applauds their developer team.  What impressed me was the way my PowerGUI program intelligently checked for, and found, a newer version, which it then installed automatically.  Just one click on the 'Agree to licence' button, and no requirement for a reboot.PowerGui Filters - Getting started

Once you have installed PowerGUI, my crucial role is to help newbies make the relatively simple connection between the GUI and the Shell (PowerShell command line).  This is a knack; you just need to know three things to get started.

1) Filter - Find the funnel symbol at the very top of the PowerGUI screen.  Creating a filter is a matter of clicking on three column headings: 'Property', 'Operator' and 'Value'.  (Note: Save As.. facility)

2) Seek two tabs low down at the bottom of the screen; the first tab says 'UI', the second tab says:  'PowerShell Code'.  Enjoy the output!

3) One more thing, you may have already spotted a 'tree' on the left of the PowerGUI.  And just like Windows Explorer, you can select drives in this 'tree' before you click on 'Filter'.  I would like to point out that if you install the QaD snap-in, with its extra cmdlets, you will see Active Directory objects in the 'tree'. 

Orientation: Naturally you need to connect to domain to gain maximum effect with this technique.  For instance, I installed PowerGUI, QaD and PowerShell on a Domain Controller.  If you just install PowerGUI on XP with no PowerShell, no QaD and no Domain, you are going to be a little disappointed.

ˆ

QaD Snap-ins

This is how I see it, PowerShell has zillions of built-in cmdlets, but not many for Active Directory.  QaD created half a zillion specialist Active Directory cmdlets and 'packaged' them into a Snap-in.  Our missing link is to install that QaD snap-in.  Furthermore, it's worth getting the QaD cmdlets whether you use PowerGUI, or script only with the PowerShell command-line shell.

Unless you have a passing familiarity with PowerShell installing the snap-in (some call them snapins) is tricky.  Assuming that you have downloaded the package from QaD, here below is the PowerShell command.  What I don't know - but you do, is where on your machine you downloaded the QaD file. My point you need to edit c:\ in the command below.

# Instruction to add a Snap-in
set-Location c:\
add-PSSnapin  quest.activeroles.admanagement

Example of QaD Active Directory cmdlet

Here is an example of a QaD (Quest Active Directory) query.  This the crucial part of what the PowerShell Code button displays.  The 'Filter' was: City (Property) Equal (Operator) Birmingham (Value).

 sb={ Get-QADUser -SizeLimit 0 -ErrorAction SilentlyContinue | where { $_.City -eq "Birmingham" }

Perhaps you can see how easy it would be to change the value of "Birmingham" to "Boston".  After a few tries, you may discover how straightforward it is to change the property .City to .Department, .Company or .Description.

More Examples of QaD cmdlets


If you are looking for handy network utilities, try some of the free downloads at Tools4Ever


Summary of PowerGUI and QaD

If you are committed to learning PowerShell, but struggle with some of its syntax, then PowerGUI is an ideal tool to help you learn to write better scripts.  Use PowerGUI like a metaphorical slider.  Click the UI button to lean towards pure mouse and menu driven methods.  Click on PowerShell Code to slide into regular command line scripting.

Even PowerShell experts struggle to script Active Directory objects.  Even experts cheat and download QaD snap-ins.  Guy says, 'Let's follow the experts and take advantage of QaD's expertise'.

See more PowerShell QAD Scripts

PowerShell Home   • Quest QAD   • QADUser   • QAD Password   • QADGroup   • QADComputer

 • Export-CSV   • Import CSV

Please write in if you see errors of any kind.  Please report any factual mistakes, grammatical errors or broken links, I will be happy to not only to correct the fault, but also to give you credit.

Download my ebook:Getting Started with PowerShell
Getting Started with PowerShell - only $9.25

You get 36 topics organized into these 3 sections:
   1) Getting Started
   2) Real-life tasks
   3) Examples of Syntax.

In addition to the ebook, you get a PDF version of this  Introduction to PowerShell ebook  It runs to 120 pages of A4.

 *


Google

Web  This website

Review of Orion NPMGuy Recommends: Orion's NPM - Network Performance Monitor

Orion's performance monitor is designed for detecting network outages. A network-centric view make it easy to see what's working, and what needs your attention.

This utility guides you through troubleshooting by indicating whether the root cause is faulty equipment or resource overload.

Download a free trial of the Network Performance Monitor

 

Home Copyright © 1999-2010 Computer Performance LTD All rights reserved

Please report a broken link, or an error.