Guy recommends :
Free Solarwinds
VM Console

Solarwinds VM Console Free Download

Find out which of your VMs are a waste of space and which VMs need more resources.



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.

Guy Recommends:  Solarwinds' Free Bulk Import ToolFree Download of Solarwinds  Bulk Import Tool

Import users from a spreadsheet.  Just provide a list of the users with their fields in the top row, and save as .csv file.  Then launch this FREE utility and match your fields with AD's attributes, click to import the users.  Optionally, you can provide the name of the OU where the new accounts will be born.

There are also two bonus tools in this free download, and all 3 have been approved by Microsoft:

  1. Bulk-import new users into Active Directory.
  2. Seek and zap unwanted user accounts.
  3. Find inactive computers.

Download your FREE bulk import tool.

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}

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.

If you like this page then please share it with your friends

 


See more PowerShell QAD Scripts

PowerShell Home   • Quest QAD   • QADUser   • QADGroup   • QADComputer

Export-CSV   • Import CSV   • QAD Password   • Add-PSSnapin  

Get-AdUser -filter   • Windows PowerShell   • Windows PowerShell .Net

Please email me if you have a better example script. Also please report any factual mistakes, grammatical errors or broken links, I will be happy to correct the fault.

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.

 *


Custom Search

Guy Recommends: WMI Monitor and It's Free!Solarwinds WMI Monitor

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.

Fortunately, Solarwinds have created the Free WMI Monitor so that you can actually see and understand these gems of performance information.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

 

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

Please report a broken link, or an error.