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.
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 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.
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.
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"
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
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.
Windows Management Instrumentation (WMI) is
most useful for PowerShell scripting.
SolarWinds
have produced this
Free WMI Monitor to take the guess work out of which
WMI counters to use for applications like Microsoft Active Directory,
SQL or Exchange Server.