A Collection of ConfigMgr 2012 Collection Queries

No Gravatar

Tommy Gunn started a great post on this same topic at SystemCenterCentral.  I’m adding my own here.

*note: these are WQL queries for ConfigMgr/SCCM collections, but all will translate to T-SQL queries for reporting.

Computers which are joined to a specific domain or workgroup

Computers which are members of a domain security group

(notice the double backslash)

 

more to come…

June 13, 2014

Posted In: ConfigMgr 2012, T-SQL

ReportServerService logs not deleted

No Gravatar

I was performing some initial discovery on a SCCM primary site server and noticed a lack of disk space. Using WinDirStat.exe I started digging deeper and discovered almost 100gb of ReportServerService_<timestamp>.log files. These are associated with the SQL Server Reporting Service and should be cleaned up after 14 days by default as configured in the ReportingServicesService.exe.config file via the parameter

However that was not happening on this server and it was soon to die under the weight of a year worth of log files.  It turns out this is a known bug as described in Microsoft KB2706518.  The solution is to upgrade SQL 2008 to Service Pack 3 and Cumulative Update 5 or higher.  Until that upgrade can happen the logging level can be changed to a value less than 3 in the config file.

You could enable NTFS compression, manually delete the files older than about 30 days, or write a script to automate that.  But why bother… just upgrade SQL! 🙂

June 11, 2014

Posted In: ConfigMgr 2007, ConfigMgr 2012, SQL Reporting

SCCM Global Conditions File Version Less Than behavior

No Gravatar

Summary

When using Global Conditions in SCCM 2012, using the File Version Less Than criteria requires that the file exists on the target computers.  If the file does not exist the deployment for the computer will have the Requirements no Met status.

Logically and mathematically speaking, Less Than could include NULL (the value returned when he file does not exist); however, in this scenario it does not.

The Saga

I was recently asked to deploy some software via SCCM 2012 that was not a valid MSI package.  Using the Application model, we decided to use multiple criteria for the Detection Method which included the MSI product code and a file version.   This did not present any challenges; however, the Requirements and target collection did.

The goal was to deploy to a single collection and install the software only if MyFile.exe did not exist (the software was not installed) or if MyFile.exe was below a specific version.  We wanted to avoid doing Software Inventory for MyFile.exe.  Using Global Conditions, SCCM can test is a file version is Less than a given value.  The question was, what would it report if the file didn’t exist.

After running a few tests the reports showed that computers which did not have MyFile.exe get an Actual Value of NULL and are flagged as Requirements not Met.  Thus the Less than logic requires that the file exists.

To avoid Software Inventory, we ended up creating a second identical Deployment Type; however, instead of testing the File Version as a requirement we tested the Existence of MyFile.exe.

Conclusion

I find it a bit annoying that the Application model Detection method can use multiple rules with AND and OR logic, but the Requirements can only use AND logic.  I should file a DCR.

 

 

 

May 13, 2014

Posted In: ConfigMgr 2012

Running Configuration Manager 2012 Remote Control without the Admin Console

No Gravatar

Jörgen Nilsson  wrote a great article at  http://ccmexec.com/2012/05/running-configuration-manager-2012-remote-control-standalone about how to run the Microsoft System Center Configuration Manager Remote Control Viewer without installing the Admin Console.

Here is the nuts and bolts:

From the directory where the AdminConsole is installed, copy CmRcViewer.exe, RdpCoreSccm.dll, and 00000409\CmRcViewerRes.dll to some other accessible folder or file share.

SCCM-RC-files1
SCCM-RC-files2

Copy the whole directory with these files present to the computer you want to run Remote Control from, and simply launch the CmRcViewer.exe

In the comments, Luis Baños offered this:

to audit create the following registry entry:

For 32 bits

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ConfigMgr10\AdminUI\Connection]
“Server”=”Site Server Name”
For 64 bits
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\ConfigMgr10\AdminUI\Connection]
“Server”=”Site Server Name”
– Specifies the name of the site server to which you want to send status messages that are related to the remote control session

 

 

I’ve gone just a bit further and added the files to a file share on my SCCM Primary site server (aliased by a DFS share), granted only the SCCM Admins and Remote Control users permissions, plus added SCCM Remote Control tools for SCCM 2007 (for mixed environments) and some batch files to pretty it up a bit.

SCCM-RC-file-share

 

SCCM-RC-file-share-permissions

SCCM-RC-script

October 10, 2013

Posted In: ConfigMgr 2012

Change SCCM 2012 Site Name/Description

No Gravatar

Changing the site name or description in SCCM is frankly a pain in the rear.  To my knowledge SCCM doesn’t use it internally and it is simply a description for the administrators to identify some characteristics about the site.  This is really only needed because the Site Code is limited to 3 characters… still.  </end rant>

I have a System Center 2012 Configuration Manager Secondary Site server and need to change it’s name/description.  In SCCM 2007 this could be done by editing the Site Control File which is unsupported by Microsoft.  SCCM 2012 doesn’t use the same type of Site Control file, it is an XML embedded in SQL.

Rikard Rönnkvist has a simple SQL statement for changing the Site name/description here: http://www.snowland.se/2012/10/12/update-configmgr-site-description

Anoop C. Nair does some interesting investigation with the embedded Site Control file here: http://anoopcnair.com/2012/05/23/configmgr-sccm-2012-how-to-edit-site-control-sitectrl-file

But I really didn’t want to hack the database.  I went looking for a WMI method and found Peter van der Woude’s PowerShell script to change a Primary Site name/description here: http://www.petervanderwoude.nl/post/changing-a-site-name-in-configmgr-2012-via-powershell

I’m still pretty new to PowerShell, but after poking at it a bit I was able to modify it to change the name/description of a Secondary Site.  Here’s the end result.  95% of the credit goes to Peter.  Thanks, Peter!

Save this code as a ChangeSiteName_v1.1_ps1

[cc lang=’powershell’ ]

[CmdletBinding()]

param (
[string]$PrimarySiteCode,
[string]$PrimarySiteServer,
[string]$SiteCodeOfSiteToChange,
[string]$NewSiteName
)

function Change-SiteName {
$Site = Get-WmiObject -Class SMS_SCI_SiteDefinition -Namespace root/SMS/site_$($PrimarySiteCode) -ComputerName $PrimarySiteServer| Where-Object -FilterScript {$_.SiteCode -eq $SiteCodeOfSiteToChange}
$Site.SiteName = $NewSiteName
$Site.Put()
}

Change-SiteName

[/cc]

Now run it.  It should work remotely, but I ran it from the Primary Site Server.

[cc lang=’powershell’ line_numbers=’false’]

PowerShell.exe -Execution Policy ByPass .\ChangeSiteName_v1.1_ps1 -PrimarySiteCode “PrimarySiteCode>” -PrimarySiteServer “PrimarySiteServer” -SiteCodeOfSiteToChange “MySiteCode” -NewSiteName “MyNewSiteName”

[/cc]

 

September 13, 2013

Posted In: ConfigMgr 2012, Scripting