Book Image

Microsoft Exchange Server PowerShell Essentials

By : Biswanath Banerjee
Book Image

Microsoft Exchange Server PowerShell Essentials

By: Biswanath Banerjee

Overview of this book

PowerShell has become one of the most important skills in an Exchange administrator's armory. PowerShell has proved its mettle so widely that, if you're not already starting to learn PowerShell, then you're falling behind the industry. It isn't difficult to learn PowerShell at all. In fact, if you've ever run commands from a CMD prompt, then you'll be able to start using PowerShell straightaway. This book will walk you through the essentials of PowerShell in Microsoft Exchange Server and make sure you understand its nitty gritty effectively. You will first walk through the core concepts of PowerShell and their applications. This book discusses ways to automate tasks and activities that are performed by Exchange administrators and that otherwise take a lot of manual effort. Microsoft Exchange PowerShell Essentials will provide all the required details for Active Directory, System, and Exchange administrators to help them understand Windows PowerShell and build the required scripts to manage the Exchange Infrastructure.
Table of Contents (17 chapters)
Microsoft Exchange Server PowerShell Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Managing Active Directory Attributes


Here is a script that will dump disabled users and computer accounts in AD to the CSV file:

Import-Module -Name ActiveDirectory
$DateTime = Get-Date -Format "MM_dd_yyyy_HH_mm"
$FileName = "Disabled_Accounts_$DateTime" 
Search-ADAccount -AccountDisabled | Select-Object Name,ObjectClass >> c:\Scripts\$FileName.csv

In the previous script, if you just want to look for disabled user accounts or computers accounts, change the cmdlet in the last line as follows:

Search-ADAccount –AccountDisabled -UsersOnly
Search-ADAccount –AccountDisabled -ComputersOnly

The Search-ADAccount cmdlet is useful if you want to find out the user's attributes such as expiring passwords, accounts whose passwords are set to never expire, locked out accounts, and so on. Here are some of the examples and, as always, you can use the help of the command using Get-Help Search-ADAccount.

If you are reviewing your current Active Directory for security vulnerabilities, one of the things that...