Appendix B. Admin examples

Although this book is not intended to be a solutions cookbook, it’s always handy to have a few domain-specific examples. This section contains a number of short examples showing how common administration tasks might be accomplished with PowerShell.

Getting active directory domain information

The following script will list the active directory information for a list of computers. If no computer names are provided, it shows the domain information for this computer. You can optionally specify a set of properties to return.

To display the domain information for the current host:



Get-DomainInfo .

To display the domain information for a set of machines:

Get-DomainInfo machine1, machine2, machine3

To get the domain ...

Get Windows PowerShell in Action now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.