Serge Chegorian's System Center Blog

Serge Chegorian's System Center Blog

SCCM 2012 R2: Setup is unable to connect to SQL Server

May 28th, 2017

This error can be very painful specifically when you’ve already checked everything:

  1. The SQL Server and instance names are entered correctly
  2. The specified SQL Server instance is not configured to use dynamic ports
  3. If a firewall is enabled on the SQL Server, inbound rules exist to allow connections to the correct ports
  4. The account used to run Setup has permissions to connect to the specified SQL server instance
  5. TCP and named pipes are enabled
  6. ODBC test succeeds.

There is one more trick. Run SQL Server Client Networking Utility (cliconfg.exe), go to Aliases tab, delete all aliases for your database name, try to connect again.

[SCCM]: How to fix SQL collation on your SCCM dedicated SQL cluster

May 17th, 2017

Sometimes in a corporate enviroment someone esle might set up SQL cluster for your SCCM and overlook the collation setting wich must be SQL_Latin1_General_CP1_CI_AS for SCCM. This is a workaround for this case assuming there is currently no database on your SQL instance.

  1. Check server General settings and Master database General settings and confirm that collaction is wrong
  2. Go to the active cluster node
  3. Bring down SQL Server resource (Server and Agent only)
  4. Start cmd.exe as Administrator
  5. Go to SQL binn folder (you’ll find it from the SQL service start string)
  6. Run command:
    sqlservr -m -T4022 -T3659 -s"<instance name>" -q"SQL_Latin1_General_CP1_CI_AS"

There will be a bunch of information messages and it should run for 2-8 minutes. After that it will display notification that it has successfully finished but it won’t exit the application. Wait for another minute, close cmd window, bring the resource up and check collation on the server and Master database.

State Message Storm in SCCM 2012

December 9th, 2015

Sometimes (in my case after SCCM 2012 upgrade to R2) you may see a high number of error messages (ID 6105) produced by SMS_STATE_SYSTEM with the following description:

SMS State System message file processing processed one or more files that contained errors or invalid data. Review the statesys.log file for further details.

The STATESYS.LOG File shows the following:

SQL MESSAGE: spProcessStateReport – Error: The key for machine <AGENTNAME> (GUID:EE344EFE-A80C-483E-BAFB-E3XXXXXXXXXX) did not match the one in the database.

That means that the client system has changed SMS GUID but this change has not been reflected in SCCM DB. You have to manually reset the agent SMS GUID to fix the problem.

If you are dealing with thousand messages and hundreds of clients you can script up this operation as I did.

To get the names for affected clients you have to go to <SCCM Installation Folder>\Inboxes\auth\\corrupt and copy all SMX files to the temporary location. Each SMS file is in fact a XML document. In order to extract system name from it I use this PowerShell script:

get-childitem *.smx | % {[xml]$statfile = get-content $_.Name

Out-File -filepath “list-of-computers.txt” -InputObject $statfile.Report.ReportHeader.Identification.Machine.NetBiosName -append


This script may produce several errors which could be ignored.

The list will contain a lot of duplicates. I get rid of them using Excel filter.

Once you have your list you may proceed with SMS GUID reset. To reset SCCM client SMS GUID you have to simply delete SMSCFG.INI file from %windir% and restart SMS Agent Host service. I use this script to reset SMS GUID on multiple servers:

$FullServerList = Get-Content “list-of-computers.txt”

foreach ($servername in $FullServerList ) {
If (Test-Connection -computername $servername -quiet) {
$RemoteFile = “\\”+$servername+”\Admin$\SMSCFG.INI”
If (Test-Path $RemoteFile) {
Remove-Item $RemoteFile
Write-Host “Deleting” $RemoteFile
(gwmi Win32_Service -filter “name=’ccmexec’” -computername $ServerName).StopService()
(gwmi Win32_Service -filter “name=’ccmexec’” -computername $ServerName).StopService()
} Else {Write-Host “Cannot connect to” $RemoteFile
}¬†Else {Write-Host $ServerName “cannot be contacted”}

How to export SCCM 2012 ADR

May 11th, 2015

How to export SCCM 2012 Automatic Deployment Rule?

1. Start SCCM 2012 PowerShell core by clicking on the down arrow in the left upper corner of SCCM 2012 Management Console – Connect via Windows PowerShell.

2. Use Get-CMSoftareUpdateAutoDeploymentRule to display all rules or Get-CMSoftareUpdateAutoDeploymentRule -Name “<rule name>” to display a specific rule.

3. Format output and/or redirect it to a file

No response from Windows Deployment Services server

March 26th, 2014

When attempting to PXE boot from SCCM 2007 or 2012 PXE boot point you may have the following symptom:

  • Windows Deployment Services service is stopped and cannot be started.

The most likely cause of it is the corrupted boot image (WinPE WIM) file.


Remove all boot images from the affected PXE Boot/DP. Start WDS service. Then start adding images one by one. Restart WDS once you can see every new package under :\RemoteInstall\SMSIMAGES\SMSPKG. If WDS crashes again, this is the corrupted one. You will need fix or regenerate this WinPE image.

Sometimes you may have this error message:

Downloaded WDSNBP...

Architecture: x64
WDSNBP started using DHCP Referral.
Contacting Server: (Gateway:
No response from Windows Deployment Services server.
Press F12 for network service boot
If I press F12, I receive a Windows Boot Manager error message (which I would expect if there's no response from the server):
Windows failed to start (etc.)
File: \Boot\BCD
Status: 0xc000000f
Info: An error occurred while attempting to read the boot configuration data.

The root cause of this issue is that you are building x64 system but your PXE boot/DP has no x86 WinPE WIM. Even on x64 systems x64 WinPE requires a boot loader from x86 version. Once you publish it the problem should disappear.

How to add packages to the distribution point using PowerShell

March 26th, 2014

This script should be executed on the primary site server

$sitecode = “XYZ”
$nameSpace = “root\sms\site_XYZ”
$sitename = “XYZ GmbH”

$ListOfPackages = @{“XYZ000001″,”XYZ00002″}

if ($ListOfPackages -ne $null) {
foreach ($packageID in $ListOfPackages) {
$NewDistPointForPackage = @{
PackageID = $packageID;
ServerNALPath = “[`"Display=\\$newBDPName\`"]MSWNET:[`"SMS_SITE=$sitecode`"]\\$newBDPName\”;
SiteCode = $sitecode;
SourceSite = $sitecode;
ResourceType = “Windows NT Server”
Set-WmiInstance -class SMS_DistributionPoint -arguments $NewDistPointForPackage -namespace $nameSpace

Serge Chegorian's System Center Blog

Serge Chegorian's System Center Blog