{"id":15,"date":"2014-05-30T12:12:23","date_gmt":"2014-05-30T12:12:23","guid":{"rendered":"https:\/\/www.lieben.nu\/liebensraum\/?p=15"},"modified":"2014-05-30T12:12:23","modified_gmt":"2014-05-30T12:12:23","slug":"scripted-deployment-of-distribution-points-in-sccm-2012-including-rate-scheduling","status":"publish","type":"post","link":"https:\/\/lieben.nu\/liebensraum\/2014\/05\/scripted-deployment-of-distribution-points-in-sccm-2012-including-rate-scheduling\/","title":{"rendered":"Scripted Deployment of Distribution Points in SCCM 2012 including rate scheduling"},"content":{"rendered":"<p>Somewhat quick and dirty, but I&#8217;m sure it&#8217;ll be of use to anyone doing a larger scale rollout of distribution points.<\/p>\n<p>The following script can interactively roll out distribution points for you, saving a huge amount of clicking around in the SCCM console. The code can easily be adapted to run everything from functions and bulk import a list of distribution points from CSV to SCCM.<\/p>\n<p>#Add distribution point with State Migration and Pulse Rate limitation and scheduling<br \/>\n#Author: Jos Lieben, OGD<br \/>\n#Copyright: Free to Use and Distribute<br \/>\n#Credits: David O\u2019Brien (david-obrien.net) for WMI class interaction<br \/>\n#notice: you must have the required console updates for some of these commands to work with SCCM 2012 SP1<\/p>\n<p>####GENERAL CONFIGURATION####<br \/>\n#If you clear any config, the script will prompt you for it, config simply helps you simplify deployments if for example, you only have one site<br \/>\n#Path to your PSD files<br \/>\nImport-Module \u201cC:\\Program Files (x86)\\Microsoft Configuration Manager\\AdminConsole\\bin\\ConfigurationManager.psd1\u2033<br \/>\n#Your site code<br \/>\n$site_code = \u201cEU1\u2033<br \/>\n#Name of your distribution point (Fully Qualified Name required!)<br \/>\n$server_name = \u201c\u201d<br \/>\n#Drive letter for your primary content library, use Automatic if you wish SCCM to manage this for you<br \/>\n$driveletter_plibrary = \u201c\u201d<br \/>\n#Drive letter for your primary content share, use Automatic if you wish SCCM to manage this for you<br \/>\n$driveletter_pshare = \u201c\u201d<br \/>\n#If you wish to add a state migration point to the DP, set this to $true<br \/>\n$add_statemigrationpoint = $false<br \/>\n#Path to data on the state migration point<br \/>\n$state_migrationpoint_localpath = \u201c\u201d<br \/>\n#Distribution Point Group Membership can be configured with this variable<br \/>\n$distributionpointgroup = \u201c\u201d<br \/>\n####END OF GENERAL CONFIGURATION####<br \/>\n####SCHEDULING CONFIGURATION####<br \/>\n#Set to False if you do not wish to configure transfer schedules for your DP ($false recommended)<br \/>\n$add_schedule = $true<br \/>\n#size of each block sent, leave at 0 to prompt, only used when add_schedule=$true<br \/>\n$block_size = 0<br \/>\n#delay between each block sent, leave at 0 to prompt, only used when add_schedule=$true<br \/>\n$block_delay = 0<br \/>\n#Array containing 24 elements, one for each hour of the day. This property specifies the type of usage for each hour.<br \/>\n# 1 means all Priorities, 2 means all but low, 3 is high only, 4 means none<br \/>\n#this example allows only high priority sendings from monday till friday between 8AM and 8PM and everything outside that timeframe<br \/>\n$HourUsageScheduleWeekdays = @(1,1,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1)<br \/>\n$HourUsageScheduleWeekend = @(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)<br \/>\n####END OF SCHEDULING CONFIGURATION#####<br \/>\n#standard variables<br \/>\n$ja = new-Object System.Management.Automation.Host.ChoiceDescription \u201c&amp;Yes\u201d,\u201dhelp\u201d<br \/>\n$nee = new-Object System.Management.Automation.Host.ChoiceDescription \u201c&amp;No\u201d,\u201dhelp\u201d<\/p>\n<p>Clear-Host<br \/>\nif($site_name -eq \u201c\u201d) {<br \/>\n$site_code = Read-Host \u201cEnter your site code (for example: EU1)\u201d<br \/>\n}<br \/>\nif($server_name -eq \u201c\u201d) {<br \/>\n$server_name = Read-Host \u201cEnter the FQDN of your new distribution point (for example: dp01.ogd.local)\u201d<br \/>\n}<br \/>\nif($driveletter_plibrary -eq \u201c\u201d) {<br \/>\n$driveletter_plibrary = Read-Host \u201cEnter the driveletter for the primary content library (for example: E)\u201d<br \/>\n}<br \/>\nif($driveletter_pshare -eq \u201c\u201d) {<br \/>\n$driveletter_pshare = Read-Host \u201cEnter the driveletter for the primary content share (for example: E)\u201d<br \/>\n}<br \/>\nif($add_statemigrationpoint -eq $true -And $state_migrationpoint_localpath -eq \u201c\u201d){<br \/>\n$state_migrationpoint_localpath = Read-Host \u201cEnter the path your state migration point should use to store data (use quotes, for example: \u201cC:\\USMT\u201d)\u201d<br \/>\n}<br \/>\nif($distributionpointgroup -eq \u201c\u201d) {<br \/>\n$distributionpointgroup = Read-Host \u201cEnter the name of the group you wish your distribution point to be a member of (for example OGD Production Site)\u201d<br \/>\n}<br \/>\nif($add_schedule -eq $true){<br \/>\nif($block_size -eq 0){<br \/>\n$block_size = Read-Host(\u201cSpecify the maximum block size in KB for the Pulse Rate (min 1, max 256)\u201d)<br \/>\n}<br \/>\nif($block_delay -eq 0){<br \/>\n$block_delay = Read-Host(\u201cSpecify the delay between blocks (min 1, max 30)\u201d)<br \/>\n}<br \/>\nif([int]$block_delay -gt 30) {[int]$block_delay = 30}<br \/>\nif([int]$block_delay -lt 1) {[int]$block_delay = 1}<br \/>\nif([int]$block_size -gt 256) {[int]$block_size = 256}<br \/>\nif([int]$block_size -lt 1) {[int]$block_size = 1}<br \/>\n}<\/p>\n<p>#bind to correct site<br \/>\nSet-Location $site_code\u201d:\u201d<br \/>\n#summarize<br \/>\nWrite-Host \u201c\u201d<br \/>\nWrite-Host \u201c\u201d<br \/>\nWrite-Host \u201cWe have enough information to proceed, the following will take place:\u201d<br \/>\nWrite-Host \u201d * A distribution point will be added to site $site_code\u201d<br \/>\nWrite-Host \u201d * The FQDN is $server_name\u201d<br \/>\nWrite-Host \u201d * A Content Library will be placed on drive $driveletter_plibrary\u201d<br \/>\nWrite-Host \u201d * A Content Share will be placed on drive $driveletter_pshare\u201d<br \/>\nWrite-Host \u201d * The DP will be added to the $distributionpointgroup group\u201d<br \/>\nif($add_statemigrationpoint -eq $true){<br \/>\nWrite-Host \u201d * A state migration point will be added\u201d<br \/>\nWrite-Host \u201d * State Migration Point Storage Path: $state_migrationpoint_localpath\u201d<br \/>\n$folders = New-CMStorageFolder -StorageFolderName $state_migrationpoint_localpath -MaximumClientNumber 100 -MinimumFreeSpace 100 -SpaceUnit Megabyte<br \/>\n}else{<br \/>\nWrite-Host \u201d * A state migration point will NOT be added\u201d<br \/>\n}<br \/>\nif($add_schedule -eq $true){<br \/>\nWrite-Host \u201d * Rate Limitation will be set to $block_size KB per $block_delay seconds according to schedule in config\u201d<br \/>\n}else{<br \/>\nWrite-Host \u201d * Rate Limitation will NOT be configured\u201d<br \/>\n}<\/p>\n<p>Write-Host \u201c\u201d<br \/>\n$options = [System.Management.Automation.Host.ChoiceDescription[]]($ja,$nee)<br \/>\n$prompt = $host.ui.PromptForChoice(\u201c\u201d,\u201dDo you wish to proceed?\u201d,$options,0)<br \/>\nWrite-Host \u201c\u201d<br \/>\nif($prompt -eq 1) {<br \/>\nWrite-Host \u201cCancelled\u2026\u201d<br \/>\nExit<br \/>\n}<\/p>\n<p>new-CMSiteSystemServer -ServerName $server_name -SiteCode $site_code<\/p>\n<p>add-CMdistributionpoint -SiteSystemServerName $server_name -SiteCode $site_code -CertificateExpirationTimeUtc \u201cMonday, January 2, 2017 1:00:00 AM\u201d -MinimumFreeSpaceMB 5000 -InstallInternetServer -PrimaryContentLibraryLocation $driveletter_plibrary -PrimaryPackageShareLocation $driveletter_pshare -EnablePxeSupport -AllowRespondIncomingPxeRequest -EnableUnknownComputerSupport<\/p>\n<p>add-CMDistributionPointToGroup -DistributionPointName $server_name -DistributionPointGroupName $distributionpointgroup<br \/>\nif($add_statemigrationpoint -eq $true){<br \/>\nadd-cmstatemigrationpoint -EnableRestoreOnlyMode $false -sitesystemservername $server_name -sitecode $site_code -storagefolders $folders -TimeDeleteAfter 7 -TimeUnit Days -AllowFallBackSourceLocationForContent $false<br \/>\n}<\/p>\n<p>if($add_schedule -eq $true){<\/p>\n<p>$Percent = 100<br \/>\n$UsageAsBackup = @($true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true,$true)<\/p>\n<p>$RateLimitingSchedule = @($Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent,$Percent)<\/p>\n<p>$SMS_SCI_ADDRESS = \u201cSMS_SCI_ADDRESS\u201d<br \/>\n$class_SMS_SCI_ADDRESS = [wmiclass]\u201d\u201d<br \/>\n$class_SMS_SCI_ADDRESS.psbase.Path =\u201dROOT\\SMS\\Site_$($site_code):$($SMS_SCI_ADDRESS)\u201d<\/p>\n<p>$SMS_SCI_ADDRESS = $class_SMS_SCI_ADDRESS.CreateInstance()<br \/>\n# Set the UsageSchedule For Weekdays<br \/>\n$SMS_SiteControlDaySchedule = \u201cSMS_SiteControlDaySchedule\u201d<br \/>\n$SMS_SiteControlDaySchedule_class = [wmiclass]\u201d\u201d<br \/>\n$SMS_SiteControlDaySchedule_class.psbase.Path = \u201cROOT\\SMS\\Site_$($site_code):$($SMS_SiteControlDaySchedule)\u201d<br \/>\n$SMS_SiteControlDaySchedule = $SMS_SiteControlDaySchedule_class.createInstance()<br \/>\n$SMS_SiteControlDaySchedule.Backup = $UsageAsBackup<br \/>\n$SMS_SiteControlDaySchedule.HourUsage = $HourUsageScheduleWeekdays<br \/>\n$SMS_SiteControlDaySchedule.Update = $true<\/p>\n<p># Set the UsageSchedule For Weekend<br \/>\n$SMS_SiteControlDayScheduleWeekend = \u201cSMS_SiteControlDaySchedule\u201d<br \/>\n$SMS_SiteControlDayScheduleWeekend_class = [wmiclass]\u201d\u201d<br \/>\n$SMS_SiteControlDayScheduleWeekend_class.psbase.Path = \u201cROOT\\SMS\\Site_$($site_code):$($SMS_SiteControlDayScheduleWeekend)\u201d<br \/>\n$SMS_SiteControlDayScheduleWeekend = $SMS_SiteControlDayScheduleWeekend_class.createInstance()<br \/>\n$SMS_SiteControlDayScheduleWeekend.Backup = $UsageAsBackup<br \/>\n$SMS_SiteControlDayScheduleWeekend.HourUsage = $HourUsageScheduleWeekend<br \/>\n$SMS_SiteControlDayScheduleWeekend.Update = $true<\/p>\n<p>$SMS_SCI_ADDRESS.UsageSchedule = @($SMS_SiteControlDayScheduleWeekend,$SMS_SiteControlDaySchedule,$SMS_SiteControlDaySchedule,$SMS_SiteControlDaySchedule,$SMS_SiteControlDaySchedule,$SMS_SiteControlDaySchedule,$SMS_SiteControlDayScheduleWeekend)<\/p>\n<p>$SMS_SCI_ADDRESS.RateLimitingSchedule = $RateLimitingSchedule<\/p>\n<p>$SMS_SCI_ADDRESS.AddressPriorityOrder = \u201c0\u201d<br \/>\n$SMS_SCI_ADDRESS.AddressType = \u201cMS_LAN\u201d<br \/>\n$SMS_SCI_ADDRESS.DesSiteCode = \u201c$($server_name)\u201d<br \/>\n$SMS_SCI_ADDRESS.DestinationType = \u201c1\u201d<br \/>\n$SMS_SCI_ADDRESS.SiteCode = \u201c$($site_code)\u201d<br \/>\n$SMS_SCI_ADDRESS.UnlimitedRateForAll = $false<\/p>\n<p># Set the embedded Properties<br \/>\n$embeddedpropertyList = $null<br \/>\n$embeddedproperty_class = [wmiclass]\u201d\u201d<br \/>\n$embeddedproperty_class.psbase.Path = \u201cROOT\\SMS\\Site_$($site_code):SMS_EmbeddedPropertyList\u201d<br \/>\n$embeddedpropertyList = $embeddedproperty_class.createInstance()<br \/>\n$embeddedpropertyList.PropertyListName = \u201cPulse Mode\u201d<br \/>\n$embeddedpropertyList.Values = @(1,$block_size,$block_delay) #second value is size of data block in KB, third is delay between data blocks in seconds<\/p>\n<p>$SMS_SCI_ADDRESS.PropLists += $embeddedpropertyList<\/p>\n<p>$embeddedproperty = $null<br \/>\n$embeddedproperty_class = [wmiclass]\u201d\u201d<br \/>\n$embeddedproperty_class.psbase.Path = \u201cROOT\\SMS\\Site_$($site_code):SMS_EmbeddedProperty\u201d<br \/>\n$embeddedproperty = $embeddedproperty_class.createInstance()<br \/>\n$embeddedproperty.PropertyName = \u201cConnection Point\u201d<br \/>\n$embeddedproperty.Value = \u201c0\u201d<br \/>\n$embeddedproperty.Value1 = \u201c$($server_name)\u201d<br \/>\n$embeddedproperty.Value2 = \u201cSMS_DP$\u201d<br \/>\n$SMS_SCI_ADDRESS.Props += $embeddedproperty<\/p>\n<p>$embeddedproperty = $null<br \/>\n$embeddedproperty_class = [wmiclass]\u201d\u201d<br \/>\n$embeddedproperty_class.psbase.Path = \u201cROOT\\SMS\\Site_$($site_code):SMS_EmbeddedProperty\u201d<br \/>\n$embeddedproperty = $embeddedproperty_class.createInstance()<br \/>\n$embeddedproperty.PropertyName = \u201cLAN Login\u201d<br \/>\n$embeddedproperty.Value = \u201c0\u201d<br \/>\n$embeddedproperty.Value1 = \u201c\u201d<br \/>\n$embeddedproperty.Value2 = \u201c\u201d<br \/>\n$SMS_SCI_ADDRESS.Props += $embeddedproperty<\/p>\n<p>$SMS_SCI_ADDRESS.Put() | Out-Null<br \/>\n}<br \/>\n#In case your executionpolicy is restricted and you can\u2019t modify it, paste these lines before calling the script<br \/>\n#Copyright Oisin Grehan<br \/>\n#START (remove #\u2019s)<br \/>\n#function Disable-ExecutionPolicy {<br \/>\n#($ctx = $executioncontext.gettype().getfield(\u201c_context\u201d,\u201dnonpublic,instance\u201d).getvalue($executioncontext)).gettype().getfield(\u201c_authorizationManager\u201d,\u201dnonpublic,instance\u201d).setvalue($ctx, (new-object System.Management.Automation.AuthorizationManager \u201cMicrosoft.PowerShell\u201d))<br \/>\n#}<br \/>\n#Disable-ExecutionPolicy<br \/>\n#END<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Somewhat quick and dirty, but I&#8217;m sure it&#8217;ll be of use to anyone doing a larger scale rollout of distribution points. The following script can interactively roll out distribution points for you, saving a huge amount of clicking around in the SCCM console. The code can easily be adapted to run everything from functions and &hellip; <a href=\"https:\/\/lieben.nu\/liebensraum\/2014\/05\/scripted-deployment-of-distribution-points-in-sccm-2012-including-rate-scheduling\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Scripted Deployment of Distribution Points in SCCM 2012 including rate scheduling<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[39,42],"tags":[],"class_list":["post-15","post","type-post","status-publish","format-standard","hentry","category-powershell","category-sccm2012"],"_links":{"self":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/15","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":0,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"wp:attachment":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}