Ole Skovgaard, IT-Architect @ Infrahouse, Lersø Parkallé 107 , 2100 København Ø, Denmark

Tuesday, November 22, 2011

Run Programs as Local System Account

By default all Configuration Manager Task sequence steps are running as the local system account therefore it occasionally can be helpful to validate any setup packages or scripts with local system privileges before applying them to any given task sequence.

To accomplish this I prefer using a program named PSEXEC.exe from Sysinternals now owned by Microsoft. In this I open a Command Prompt and from that shell I am able to execute any setup or script file I intend to run.

Quick Step
  1. Download PsTools. (Link)
  2. Run (with elevated rights): psexec -i -s cmd.exe
  3. To ensure that you are running as Local System Account type Whoami in the console
  4. Run your setup or script file that you want to test.
Start CMD with PSExce.exe










WhoamI - from here you can execute any program as Local System.
















NOTE: In Configuration Manager 2007 SP1 and earlier, task sequences always run by using the local system account, so there is no option of running a task sequence for each individual step. In Configuration Manager 2007 R2, the task sequence command-line step can be modified to run as a different account.

Tuesday, October 18, 2011

Eliminated Distribution Points still show up in 'Site System Status', Configuration Manager.

Occasionally I experience that eliminated Distribution Points still show up in Site System Status in Configuration Manager with failed status. These issues often occur either because the DP has been removed incorrectly from Configuration Manager or because of some variety error in the removal process. In the below text you will find a quick guide in how to remove the DP from Site system components status.


This is not supported by Microsoft and use is at your own risk

Run below SQL command on the Config Mgr. Database server. Change the Sitecode='CEN' to your own Sitecode.

Search the database for obsolete records:
SELECT * FROM dbo.Summarizer_SiteSystem WHERE sitecode='CEN' AND status <> 0

Copies the records to a new table for backup just in case it is needed:
SELECT * INTO Summarizer_SiteSystem2 FROM dbo.Summarizer_SiteSystem WHERE sitecode='CEN' AND status <> 0

Delete obsolete records:
DELETE FROM dbo.Summarizer_SiteSystem WHERE sitecode='CEN' AND status <> 0

Update status record to set new status:
UPDATE dbo.Summarizers_Status SET status=0 WHERE sitecode='CEN'

Wednesday, September 28, 2011

Run program based on Config Mgr. task sequence variables

I regularly come across tasks where it is necessary to execute an MSI or EXE file with separate parameters based on ex. geographical location, organization structure, Production/Test environment etc.
To manage this I create a script based on Task sequence variables and execute the program by using these variables.  

These Task Sequence variables can either be set as collection variables in Config Mgr. or as a fronted HTA. 

Usage: Place the script in the same package/folder as the MSI/EXE you want to execute.

This script gathers a total of five Task Sequence variables (ProductionORTest, testenvironment-BaseSERVER, testenvironment-DBSERVER, Production-DBSERVER, Production-BaseSERVER).  All the variables are set by a Fronted HTA that has been created. The variables could also have been set to Confg Mgr. collections containing machine accounts for either test or production.

In the below sample script the Task sequence variable “ProductionORTest” is used to determine if the MSI file should install an client in production environment or in test environment.


Save below sample script as ZTI-RunProgramTSvar.vbs

' //*************************************************************************
' // ***** Script Header *****
' // 
' // File: ZTI-RunProgramTSVar.vbs
' //
' // Purpose: Execute program (MSI/EXE) based on Task Sequence Variables
' //
' // Usage: cscript ZTI-RunProgramTSVar.vbs
' //
' // Script Version: 1.0.0
' //
' // 1.0.0  Created by Ole Skovgaard (www.Infrahouse.com)
' //
' // Customer History:
' //
' // ***** End Header *****
' //*************************************************************************

Onerrorresumenext

Dim objShell
Dim objFSO

Set objShell        = WScript.CreateObject("WScript.Shell")
Set objFSO          = CreateObject("Scripting.FileSystemObject")

strWinDir             = objShell.ExpandEnvironmentStrings("%SYSTEMROOT%")
strSystemDir         = objShell.ExpandEnvironmentStrings("%SYSTEMDRIVE%")

objShell.CD           = objFSO.GetParentFolderName(Wscript.ScriptFullName)
ScriptDir              = objShell.CD

Set env               = CreateObject("Microsoft.SMS.TSEnvironment")

ProductionORTest    = env("ProductionORTest")


IfLCase(ProductionORTest) = LCase("testenvironment") Then

BaseSERVER          = env("testenvironment-BaseSERVER")
DBSERVER            = env("testenvironment-DBSERVER")
Else

BaseSERVER          = env("Production-BaseSERVER")
DBSERVER            = env("Production-DBSERVER")

EndIf


Command =  "MSIEXEC /i """ & ScriptDir & "\Setup.msi"" /l*v+ " & strSystemDir & "\Setup.log /qb ALLUSERS=1 BaseSERVER=" & BaseSERVER & " DBSERVER=" & DBSERVER

irun = objShell.Run(Command, 0, true)

Monday, September 19, 2011

Configuration Manager Support Announcements for August 2011

Configuration Manager 2007 now supports Microsoft SQL Server 2008 R2 SP1 and Microsoft SQL Server 2008 SP3.

System Center Configuration Manager 2007 SP2, R2 and R3 now supports Microsoft SQL Server 2008 R2 SP1 and Microsoft SQL Server 2008 SP3 as a Configuration Manager 2007 site database.

The Reporting Service Point site system role and Client Status Reporting feature found in System Center Configuration Manager 2007 R2 and R3, are also supported with these versions of SQL Server.

No software updates are required.

Read more:
System Center Configuration Manager Team


Configuration Manager Supported Configurations:
http://technet.microsoft.com/en-us/library/bb680717.aspx