Datasheet
50 CHAPTER 1
•
USING POWERSHELL WITH ACTIVE DIRECTORY
is example connects to the
root\cimv2
namespace and uses the class
StdRegProv
, which provides access to the system’s registry.
In addition to using the WMI provider, PowerShell provides a series of cmdlets you
can use to interact with WMI. You can view these cmdlets by running the following
command:
PS C:\> get-command -Noun *wmi*
CommandType Name Definition
----------- ---- ----------
Cmdlet Get-WmiObject Get-WmiObject [-Class] ...
Cmdlet Invoke-WmiMethod Invoke-WmiMethod [-Clas...
Cmdlet Register-WmiEvent Register-WmiEvent [-Cla...
Cmdlet Remove-WmiObject Remove-WmiObject [-Clas...
Cmdlet Set-WmiInstance Set-WmiInstance [-Class...
e two WMI cmdlets you’ll be primarily working with in this book are
Get-WmiObject
and
Set-WmiObject
. ese cmdlets are respectively used for
retrieving WMI information and con guring WMI information. We’ll be discuss-
ing how to use these cmdlets throughout the remainder of this book.
Prepare Your Environment for the Active Directory Module
Before you can begin using the Active Directory module to manage Active
Directory, you’ll need to take some steps to prepare the environment. Depending on
your current Active Directory con guration, you may need to make changes on a
domain controller in your forest.
Configure Domain Controllers
As mentioned in the previous section, the Active Directory module requires that at
least one domain controller be running ADWS or ADMG.
Install Active Directory Web Services
ADWS will run only on your Windows Server 2008 R2 domain controllers. When
you promote a Windows Server 2008 R2 member server to a domain controller,
the ADWS component is automatically installed and enabled. One situation you
c01.indd 50c01.indd 50 5/12/2011 1:07:57 PM5/12/2011 1:07:57 PM