#Script is to enable the enable Content Validation on all SCCM DPs in your infrastructure
#could only be run from "Windows PowerShell (x86)" as it doesn't work with 64 bit PS
cls
Import-Module ($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1')
$PSD = Get-PSDrive -PSProvider CMSite
#in case there are more that 1 SCCM sites, we are connecting to the first one
CD "$($PSD[0]):"
#SCCM 2012 site code
$SiteCode = $PSD[0].name
#SCCM 2012 site server
$SCCMserver = $PSD[0].root
$AllDPs = Get-WmiObject -computer $SCCMserver -Namespace root\sms\site_$($SiteCode) -Class SMS_DPStatusInfo -Property NALPath
foreach ($DP in $AllDPs)
{
$ServerFQDN = $DP.NALPath.Substring(12).Split('\')[0]
if ($ServerFQDN)
{
#optionally set the validation schedule (weekly)
#$ValidationSchedule = New-CMSchedule -Start $(Get-Date -Year 2014 -Month 05 -Day 31 -Hour 1 -Minute 0 -Second 0) -DayOfWeek Saturday
#use default SCCM validation schedule (uncomment the trailing part to use the previously defined schedule)
Set-CMDistributionPoint -SiteCode $SiteCode -SiteSystemServerName $ServerFQDN -EnableValidateContent $true #-ValidateContentSchedule $ValidationSchedule
Write-Host "Validation Scheduled on $($ServerFQDN)"
#Write-Host "for $(Get-Date -Year 2014 -Month 05 -Day 31 -Hour 1 -Minute 0 -Second 0)"
}
}
Sunday, June 8, 2014
PowerShell script to enable Content Validation on all SCCM DPs in your infrastructure
By default DP content validation is disabled in SCCM 2012.
If you got numerous Distribution Points, it might be tiresome to go and enable it one by one. The script below would do it for your whole infrastructure, it's using SCCM default settings and schedule. You might uncomment schedule definition part, to use your own.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment