PowerShell and Get-QADComputer

PowerShell and Get-QADComputerPowerShell 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 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 and import the users.

Optionally, you can provide the name of the OU where the new accounts will be born. Download your FREE bulk import tool.

If you need more comprehensive application analysis software,
Download a free trial of SAM (Server & Application Monitor)

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}

Review SolarWinds Free CSVDE Import Tool »

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   • Free Import User CSVDE Tool

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.