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

or

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 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.