Friday, January 24, 2014

Use SCCM Collection variables to target Client computer objects

When you decide to use SCCM 2012 as a configuration manager for multiple tenants (comprising of multiple clients) SCCM does not have means to select computer object of a specific client on its name and subsequently its environment, SLA etc. to enable this mechanism SCCM must have a means of identification to make a query.
In order to get these identification items into SCCM available for selection based on a (SQL) query, collection variables can be used to identify a machine as part of client xyz. the mechanism to enable this is drawn in the following figure:
image
It works as follows:
  1. Define collection variables on the collection in SCCM which holds all object you want this variables to hold (this link shows how)
  2. Modify the MOF files used for hardware discovery (see link)
  3. Create a package that holds a script that reads the collection variables and sets them in the registry of the client (an example is shown here, we use the registry key Workspace as means of selection of these kind of variables) . Deploy the package to the collection mentioned in step 1  
    #############################
    #
    #  ToolingVariables.ps1
    #  Script designed by Bas Huygen
    #  jan 2014
    #  version 0.3
    #############################

    If(Test-Path -path HKLM:\Software\Workspace){
    $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
    #set definitions
    $Customer = $tsenv.Value("Customer")
    $CustomerEnvironment=$tsenv.Value("CustomerEnvironment")
    $Customercode=$tsenv.Value("Customercode")
    $SLA=$tsenv.Value("SLA")
    $WorkspaceName=$tsenv.Value("WorkspaceName")
    $WorkspaceVersion=$tsenv.Value("WorkspaceVersion")
    $ToolingVar1=$tsenv.Value("ToolingVar1")
    $ToolingVar2=$tsenv.Value("ToolingVar2")
    $ToolingVar3=$tsenv.Value("ToolingVar3")

    #set registry items
    set-itemproperty -path HKLM:\Software\Workspace -name Customer -value $Customer
    set-itemproperty -path HKLM:\Software\Workspace -name CustomerEnvironment -Value $CustomerEnvironment
    set-itemproperty -path HKLM:\Software\Workspace -name Customercode -Value $Customercode
    set-itemproperty -path HKLM:\Software\Workspace -name SLA -Value $SLA
    set-itemproperty -path HKLM:\Software\Workspace -name WorkspaceName -Value $WorkspaceName
    set-itemproperty -path HKLM:\Software\Workspace -name WorkspaceVersion -Value $WorkspaceVersion
    set-itemproperty -path HKLM:\Software\Workspace -name ToolingVar1 -Value $ToolingVar1
    set-itemproperty -path HKLM:\Software\Workspace -name ToolingVar2 -Value $ToolingVar2
    set-itemproperty -path HKLM:\Software\Workspace -name ToolingVar3 -Value $ToolingVar3
    }

    Else{Write-Warning "This system is already equipped with customer variables; Installation aborted"}
  4. Create a Task Sequence that reads the collection variables and registers them in the local registry with the aid of the script of step 3
  5. Read the collection variables like this
    Use the script like this
  6. Deploy this task sequence to the collection of the machines you want to configure with collection variables
  7. The variables are set in the registry of the client by running the script from step 3 
  8. The next hardware scan the relevant portion of the registry is scanned and the results are added to the hardware properties of the client in the SCCM database
image
As soon as the registry has the settings and the MOF file is modified to scan the relevant portion of the registry, these settings are available in SCCM for querying. now you can create collections based on these settings and build reports with it as well.
image
Example of query criterion in SCCM 2012 R2

Friday, January 10, 2014

Funny IT codes

Today I'll share a short, simple and humorous blog entry: did you ever notice that the IT has some names-, error- and informational code that looks a lot like military stuff?

Here is a list of military sounding IT code I could find:
  • Spyware
  • Private cloud
  • Major incident
  • Kernel Panic
  • General Failure
  • Agent ..