Chapter 31. Scripting Active Directory with PowerShell
This chapter will show you how take advantage of Windows PowerShell to execute common Active Directory administration tasks. Over the course of this chapter, we’ll examine tasks centered on management of users, groups, computers, and organizational units. After mastering these elements, we will go on to assemble a PowerShell script that can be used to populate an Active Directory test domain. As a capstone to this activity, we will look at a number of third-party PowerShell snap-ins that can extend the script built in this chapter.
Note
If you haven’t already, take a few minutes to review Chapter 29 for an introduction to managing Active Directory with .NET.
Becoming Familiar with .NET
Working with Windows PowerShell doesn’t require that you understand
all the intricacies of .NET or even be a developer. However, having a
basic grasp of the .NET classes used for working with Active Directory
will make you much more productive. In this section, we’ll take a look at
the key .NET classes used throughout this chapter and how to leverage them
in PowerShell. The majority of these classes are located in the System.DirectoryServices
namespace, which we’ll abbreviate as SDS
throughout this chapter.
DirectoryEntry
Almost anytime you need to represent an object in Active
Directory, chances are you’ll be using the DirectoryEntry
class. This is so common that PowerShell actually includes a shortcut for referencing objects in Active Directory. If ...
Get Active Directory, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.