ConfigMgr 2012 RC2 – Primary Site is Read-Only

Tuesday, 7. February 2012

In the course of evaluating ConfigMgr 2012 in my lab, I ran into an issue where my Primary site would be in read-only mode. This only occured when using the Primary site along with a Central Administration Site; a standalone Primary site would not exhibit this issue.

Another blog explained my issue perfectly, but they had no solution (link). In short, I received the following message when launching the ConfigMgr console on the Primary site server:

Your Configuration Manager console is in read-only mode while this site completes tasks related to maintenance mode.

After these tasks are complete, you must reconnect you Configuration Manager console before you can edit or create new objects.



The cause for this issue is a lack of replication between the CAS and the Primary site. When you look in Monitoring -> Database Replication, you will probably see that the “Link is being configured”. Until the link is configured, and the necessary replication from the CAS to the Primary site has occured, the Primary site will remain read-only.

The solution (at least in my case) was quite simple. Both sites were using unique instances on the same SQL server, and the SQL Server Service Broker (SSB) port was left at the default value of 4022 when installing each site. A conflict arises when both sites attempt to use the same port for the SSB. To avoid the issue, use a different (and unused!) port for each CAS/Primary site.

If you’re already experiencing the issue, you may re-run the installer and change this:

  1. Run the installer from the local installation directory (for example: C:\Program Files\Microsoft Configuration Manager\bin\X64\SETUP.EXE).
  2. Choose Perform site maintenance or reset this Site from the Available Setup Options screen.
  3. Choose Modify SQL Server configuration from from the Site Maintenance screen.
  4. Adjust the SSB Port setting on the Database Information screen and complete the wizard.

Once you complete the wizard, you will begin to see increased activity on SQL server. It may take a few minutes, but you will notice the Database Replication status will change as the replication setup progresses. You can also monitor the rcmctrl.log file on each site for activity noting that replication is progressing.

(Credit goes to an unknown ConfigMgr at Microsoft who was able to answer questions that I passed through another contact.)

My First *REAL* PowerShell Script

Friday, 13. August 2010

So I’ve done a few one-liner’s in PowerShell to more efficiently collect certain information about a server, folder, etc, but today I wrote what I consider to be my first real PowerShell script.  It should be no coincidence that today’s workday was the conclusion of a week of PowerShell training from Microsoft.

Anyway, the concept behind the script is simple.  I have a few network shares to which our deployment of Microsoft Configuration Manager sites perform their backups to.  I wanted a quick and easy way to be assured that those backups were completing properly.  This script does the following:

  • Loop through each of the main SCCM backup folder shares (one at each major datacenter)
  • Loop through each site backup folder
  • Determine if folder was modified within the last 24 hours
  • Determine if the backup task’s log file was modified within the last24 hours
  • If above conditions are true, open the log file and ensure that it says that the task completed with no errors
  • If above conditions aren’t true, note the directory of the failed backups.
  • Report backup status to the console.  If backups failed, report SCCM site code.
function Check-SCCMBackups
# $arrBackupFolders contains a list of locations that contain SCCM backups.
$arrBackupFolders = "\\server1\share1","\\server2\share2","\\server3\share3"
$dateYesterday = (Get-Date).addDays(-1)
# Initialize variables
# variable to hold list of sites whose backups did not run
$strSiteBackupNotRun = ""
 # variable to hold list of sites whose backups ran but failes
$strSiteBackupFailed = ""
$boolTasksDidRun = 1 
# initialized to 1; set to 0 if any backup task did execute successfully
$boolTasksRanSuccessfully = 1 
Write-Host "Checking status of SCCM backup folders... " -nonewline
# Loop through each value of $arrBackupFolders....
ForEach ($strUNCPath in $arrBackupFolders)
# ... and get the directories it contains.
$objBackupFolders = Get-ChildItem $strUNCPath | where {$_.PsIsContainer}
# Loop through each discovered directory....
ForEach ($objDirectory in $objBackupFolders)
# ... and check it directory was modified within the last day.
if ($objDirectory.LastWriteTime -ge $dateYesterday)
# Task executed (we know because folder write time was updated)
# Open log file and determine if job completed successfully.
$strLogFilePath = $strUNCPath + "\" + $objDirectory.Name + "\" + $objDirectory.Name + "Backup\smsbkup.log"
# Check smsbkup.log file modify time to ensure it was
# modified within the last 24 hours.
$strLogFile = Get-Item $strLogFilePath
# File was NOT (!) modified in last 24 hours!
If (!$strLogFile.LastWriteTime -ge $dateYesterday)
# Since log file was not modified (something else must've written to the directory)....
# Add Site Code (directory name) to the list of sites that did not run and set the flag...
$strSiteBackupNotRun = $strSiteBackupNotRun + " " + $objDirectory.Name
$boolTasksDidRun = 0
# ...then stop processing this object and continue with the loop.
# Line indicating success is four lines from the bottom of the file.
$strLine = (Get-Content $strLogFilePath)[-4]
# If the line doesnt match criteria, backup did not complete successfully.
if ($strLine -notmatch "Backup task completed successfully with zero errors")
# Task ran but did not complete successfully
# Add Site Code (directory name) to the list of failed backups....
$strSiteBackupFailed = $strSiteBackupFailed + " " + $objDirectory.Name
# ... and set the flag indicating that one or more tasks did not complete successfully.
$boolTasksRanSuccessfully = 0
# Task did not run as the directory modified date is not within last day.
# Add Site Code (directory name) to the list of sites that did not run and set the flag
$strSiteBackupNotRun = $strSiteBackupNotRun + " " + $objDirectory.Name
$boolTasksDidRun = 0
Write-Host "Complete!"
# Check status of boolean flags and present data.
if ($boolTasksDidRun -eq 0 -OR $boolTasksRanSuccessfully -eq 0)
# One or more tasks did not execute or failed during execution.
if ($boolTasksDidRun -eq 0)
# One or more tasks did nto execute; list the site codes (directory names).
Write-Host "Backup tasks for the following sites did not run: $strSiteBackupNotRun" -foregroundcolor red -backgroundcolor black
if ($boolTasksRanSuccessfully -eq 0)
# One or more tasks did not run successfully; list the site codes (directory names).
Write-Host "Backup tasks for the following sites did not complete successfully: $strSiteBackupFailed" -foregroundcolor red -backgroundcolor black
elseif ($boolTasksDidRun -eq 1 -AND $boolTasksRanSuccessfully -eq 1)
# All tasks completed successfully
# (Directory modify dates are within 24 hours and all log files show last task execution was successful.)
Write-Host "All SCCM backup tasks executed and ran successfully." -foregroundcolor green
Write-Host ""

SCCM: Determining collection refresh time using PowerShell

Monday, 21. June 2010

I recently had a need to examine the last refresh time of a large number of SCCM collections. We had a group of collections which are used to define maintenance windows for various servers, and we wanted to ensure that all these collections were updating regularly (and to fix the ones that weren’t).

Normally, I would take such a boring task and look for some way to automate it. I have a co-worker who evangelizes about the merits of PowerShell every chance he gets and we were able to put together a few lines to get the information I was looking for.

So obviously this requires that you have PowerShell installed, and it does require PowerShell v2. We used the SCCM PowerShell module located here, which appears to be the most “complete” unofficial PowerShell module I’ve found so far.

Once your PowerShell environment is configured, connecting to an SCCM server is as easy as:
$SCCMServer = Connect-SCCMServer servername

Next, you can do other things like:
# get all SCCM collections
$AllCollections = Get-SCCMCollection -SccmServer $SCCMServer

#show all not updated today
$a | where {$_.LastRefreshTime -notlike ‘20100621*’} | select Name

Instead of getting a list of all collections, you could target only certain ones:
$a = Get-SCCMCollection -sccmserver $sccm | where {$ -like 'Test*'} | Select name

The lines above were enough to save me tons of time I would otherwise spend manually verifying each collections properties. There are plenty of other opprotunities in this module including the ability to gather all sorts of information about advertisements, collections, sites, and packages, and I plan to continue to look for opprotunities where using these tools can allow me to work more efficiently.

MCTS: System Center Configuration Manager

Saturday, 19. June 2010

I posted previously about attending a Microsoft authorized training course on Microsoft System Center Configuration Manager (officially shortened to ConfigMgr, but commonly referred to as SCCM). After that course, I had intended on taking the exam but as the product was not one in which I was involved with regularly, and some life stuff that got in the way, I put it off.

This year my work responsibilities have shifted and I’m now managing my employer’s ConfigMgr environment. I’ve spent time since getting back up to speed on the product, remembering those details from the class and learning other details which you can only get by experience on a “real-world” deployment. Because I’ve been so deep in ConfigMgr lately, it seemed to only make sense that I should get the test out of the way, and the fact that Microsoft’s “Second Shot” program is nearing an end prompted me to start studying.

Overall, I would say the biggest study tool I used was my employment. Aside from that, I also used this book which I have found to contain a good amount of information.  Microsoft also has information on its page which gives details about the exam, skills measured, and recommend training; that information can be found here.

MCTS: System Center Configuration Manager

Microsoft SCCM Training

Sunday, 25. January 2009

At the office, we’re starting to deploy the Microsoft System Center suite, beginning with the Configuration Manager tool.  This tool is the next version of Microsoft’s System Management Server (or SMS).

In order to get up to speed, I was sent to a local Microsoft authorized training facility.  The class is 5 days long and covers everything from product installation and configuration, to design and OS/software deployment.

I’m also reviewing the course requirements for Microsoft test 70-401.  Information about this exam can be found here.