Skip to content

Create new Site Server as Distribution Point with Powershell

Featured Replies

Is it possible to automate Site Server creation with PowerShell? I'm looking at creating Distribution Points at over 150 sites. Automating this would make it much faster and easier on everyone. My plan is to virtualize the servers and have them already staged at each site (Windows Server 2012, WDS and other pre-reqs already applied).

The goal is to run a script adding the server as a Site System and also making it a Distribution Point and possibly a Software Update Point as well.

  • Author

Awesome! Thanks so much. I think this is going to be perfect.

I'll have to update to CU1, but that's no problem at all since this is a new deployment.

 

  • Author

Okay... so I've starting testing this commandlet using PowerShell, but it's running into issues. I also have an open thread on TechNet, but no one has figured this out yet.

Here's the exact string of what's being entered and the error in PowerShell:

PS C:\Windows\system32> New-CMSiteSystemServer –ServerName "Win7-SCCM-Test" -SiteCode "DP1"
New-CMSiteSystemServer : Cannot validate argument on parameter 'ServerName'.
System.Management.Automation.ValidationMetadataException
At line:1 char:36
+ New-CMSiteSystemServer –ServerName "Win7-SCCM-Test" -SiteCode "DP1"
+                                    ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: ( [New-CMSiteSystemServer], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ConfigurationManagement.Cmdlets.HS.Commands.N
   ewSiteSystemServerCommand

So in essence, the parameter "ServerName" (which is a required parameter for obvious reasons) is failing for some reason and we can't figure it out. I'd like to be able to use this on a long list of servers that will become Site Servers and eventually Distribution Points/Software Update Points.

  • Author

So... the short story is that I have figured this out with some help on TechNet.

First of all, it's easier if you run PowerShell from the Configuration Manager Console as you can see in the picture below (source link here: http://cm12sdk.net/?page_id=1623) :

 

ConfigMgr_Console_2.png

Or insure that you're running ALL commands from the appropriate directory and then connect to the Primary or CAS server.

 

Type the following commands in PowerShell Console

  1. C:
  2. cd ‘.\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin’
  3. Import-Module .\ConfigurationManager.psd1
  4. Set-Location XXX:
  5. Now you are ready to manage your Configuration Manager infrastructure

 

Once you're in the right location, the server name input must be the FQDN if you want to mitigate errors. The SiteCode parameter needs to be based on your Primary site or secondary site code that the system will connect to.

 

So in my case I altered my code. The CSV format is here:

 

DPServerName,DPSiteCode

Server1, XX1

Server2, XX2

Server3, XX1

Code here:

$csv_path = 'c:\scripts\test.csv'
$csv_import = Import-CSV $csv_path

ForEach ($item in $csv_import)
{
	$DPServerName = $item.DPServerName
	$DPSiteCode = $item.DPSiteCode
	New-CMSiteSystemServer -ServerName $DPServerName -SiteCode $DPSiteCode
}

My next phase is to then use Powershell to do the same process and make them distribution and software update points. When I get a bit better at PowerShell, I'd like to integrate that step into this code as well.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.