Book Image

Microsoft System Center Powershell Essentials

Book Image

Microsoft System Center Powershell Essentials

Overview of this book

Table of Contents (15 chapters)
Microsoft System Center PowerShell Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
4
Administration of Operations Manager through PowerShell
Index

Scenario 1 – adding multiple distribution points to a distribution point group


This is one common scenario where Configuration Manager administrators are required to add multiple distribution points to a distribution point group (DP group). A text file with the distribution point list can be used as the input to the script.

Prescripting activities

Create a text file at D:\PowerShell\DPFile.txt (you can use your convenient location) and populate the file with the distribution points to be added to the DP group.

To show you a sample, DPFile.txt should contain DP names, as follows:

GURU.COM
DP1.GURU.COM
DP2.GURU.COM

Also, it is important to note that we should enter one DP name per line. Our sample file will look something like the following screenshot:

Assumption

We will assume the distribution point group is named Test Distribution Group and the text file location as D:\PowerShell. Look at the following code:

$FilePath = "D:\PowerShell\DPFile.txt"
$DPNames = Get-Content –path $FilePath
ForEach(...