Windows PowerShell


PowerShell and Get-QADComputer

PowerShell and Get-QADComputer PowerShell get-Computer

The get-QADComputer cmdlet has some unexpected parameters.  For example, you can check which operating system, and which service pack is installed on each of your servers.  If you have not used the QAD cmdlets before, it may be best to start with QADUser.

Topics for PowerShell's Get-QADComputer

 ♣

Pre-requisites, particularly for the QAD snap-in

Before we can get my examples to work you need to meet these pre-requisites.

  1. Download and install PowerShell and .Net Framework. 
    Go to Microsoft's site and choose the flavour to suit your operating system.
  2. Download, then install the QAD Snap-ins from this site:
    http://www.quest.com/activeroles-server/arms.aspx
  3. Register the snap-in. (Key point)
    add-PSSnapin quest.activeroles.admanagement
  4. Gain access to Active Directory.  Best would be to logon at a domain controller in a test domain.

Example 1:  List the properties of get-QADComputer

Before we tackle the main task, let us research which interesting parameters to include in our script.

 get-QADComputer | get-Member 

Note 1:  get-Member (or gm) reveals a rich selection of properties, for example, ComputerRole, OSVersion and OSServicePack.

Example 2: List the computers in your domain, and their properties

Important:  You need to change yourDom/ to reflect the name of your domain.  If you are in any doubt check with Active Directory Users and Computers.

# PowerShell script to list computers, including DCs
# Author: Guy Thomas
# Version 1.2 August 2008 tested on PowerShell v 1.0
$OU = "yourDom/"
get-QADComputer -searchRoot $OU -searchScope 'SubTree' `
| format-Table name, ComputerRole, Path, OSVersion, OSServicePack -auto

Note 1:  I suggest you try my parallel learning technique and match the user properties revealed by QADComputer, with the property sheet that you see in Active Directory Users and Computers.  Look in the Domain Controllers folder, as well as the Computers folder.

Drill down with -SearchScope

SearchScope is a modifier for -SearchRoot.  While we have used the value 'SubTree', it is also possible to substitute 'OneLevel', or even 'Base'.

  ˚

Help getting to know QADComputer

 get-Command | Where {$_.name -match "QADComputer"}

Note 1:  A mild surprise, there is no 'set' cmdlet, just the one verb, 'get'.  Consequently you cannot add descriptions to a computer object using these quest cmdlets.

Real-life Task: Updating Computer Descriptions

The situation:  Paul Ku needed to update the ldap description field for his servers.

Preparation:  Paul employed a spreadsheet to store the server names and their corresponding descriptions.  Key point, Paul produced a csv file (called serverdescriptions.csv)

# Title: Update Server Description
# Desc: Import the server descriptions from a spreadsheet
# Author: Paul Ku
# Date: Nov 3 2008

# Serverdescriptions.csv contains 2 columns with headers,
# Server, Descriptions respectively.
# Each row contains "Server name", "Role or description"

import-csv serverdescriptions.csv |
foreach $_ {get-qadcomputer $_.server |
set-qadobject -description $_.description}

Guy Recommends: SolarWinds LANSurveyorSolarwinds LANSurveyor

LANSurveyor will produce a neat diagram of your network topology.  But that's just the start; LANSurveyor can create an inventory of the hardware and software of your machines and network devices.  Other neat features include dynamic update for when you add new devices to your network.  I also love the ability to export the diagrams to Microsoft Visio.

Finally, Guy bets that if you take a free trial of LANSurveyor then you will find a device on your network that you had forgotten about, or someone else installed without you realizing!

Download a Free Trial of LANSurveyor

Summary of Get-QADComputer

Get-QADComputer is a read only command to investigate properties of your Active Directory computers including domain controllers.  The secret of getting good results is investigating the names of properties, such as ComputerRole.

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-2009 Computer Performance LTD All rights reserved

Please report a broken link, or an error.