CCMEXEC.COM – System Center blog

CCMEXEC.COM – by Jörgen Nilsson

Sometimes an OS deployment fails for different reasons, one thing that can be a problem is that users in some cases don’t see the error message saying that the installation failed and starts using the computer. Even if we use “SMSTSErrorDialogTimeout” to change the default 15 minutes error dialog to 22 hours, the installation can be initiated over a weekend for instance.
If the installation fails near the end of the Task Seqeunce it could only be one application missing an nobody notice it.

I have written two small scripts for this, one that actually disables the computer account in AD if the TS fails and one that changes the logon background in Windows 7 to an awful looking background which cannot be missed by the user, of course this is just a sample.
If the Task Seqeunce fails it would look like this if the user tries to logon:

DisableComputer

Then no user cannot use the computer for sure.
I use it in an MDT task sequence so I put the two additional steps in the section “Gather Logs and StateStore on Failure” which is executed in case of a Task Sequence failure.

Here is how to implement it:

  1. Download the scripts needed here: TSerrorscript
  2. Place them in a folder that can be used as source folder as below.
    DisableComputer4
  3. In the backgrounds directory replace my ugly example logon background with your own.
  4. Create a package in Configuration Manager with the folder with the scripts as source folder and distribute it to your DP’s.
  5. In the Task Seqeunce add a step for disabling the computer account. I use the same account as I use to join the domain.
    DisableComputer5
  6. Set a condition to only run if not in WinPe as there is no account to disable if the computer is not in AD.
    DisableComputer6
  7. Then we add a step to change the background and use the same condition as above for this step.
    DisableComputer7That is it, now you are ready to test it out.

The recording from our System Center User Group Livemeeting, “System Center 2012 Configuration Manager – Tips & tricks”  is now live on Youtube!
The recording is in Swedish.

Livemeeting

http://www.youtube.com/watch?v=HaEVZ08E-z0&feature=plcp

I wrote post a long time ago on how to modify the builtin reports in Configuration Manager 2007 to display serial numbers for Lenovo computers as well as they are not stored in the same WMI class, http://ccmexec.com/2010/04/lenovo-computers-and-serial-numbers-in-reports/

Per request here is how to do the same in Configuration Manager 2012 for the report “Hardware 01A – Summary of computers in a specific collection”

Hardware 1a_1

  1. Launch the Admin Console with elevated priviliges, Right Click and select “Run As Administrator”
  2. Right-click on the report called “Hardware 01A – Summary of computers in a specific collection” and select “Edit”
  3. Report Builder will then be launched, depending on which SQL Version you use it will be either 2.0 or 3.0. If you are using SQL Server 2008 R2 you should edit the registry before so that the console can launch the correct version of the Report Builder, more information can be found here:
  4. Double-Click on Dataset0
  5. In the Query add /change the following lines displayed in red below:

select  distinct

v_R_System_Valid.ResourceID,

v_R_System_Valid.Netbios_Name0 AS [Computer Name],

v_R_System_Valid.Resource_Domain_OR_Workgr0 AS [Domain/Workgroup],

v_Site.SiteName as [SMS Site Name],

[Top Console User] = CASE

when (v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.TopConsoleUser0 is NULL or v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.TopConsoleUser0 = ‘-1′)

then @UnknownLoc

Else v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.TopConsoleUser0

End,

v_GS_OPERATING_SYSTEM.Caption0 AS [Operating System],

v_GS_OPERATING_SYSTEM.CSDVersion0 AS [Service Pack Level],

v_GS_PC_BIOS.SerialNumber0 AS [Serial Number],

v_GS_SYSTEM_ENCLOSURE_UNIQUE.SMBIOSAssetTag0 AS [Asset Tag],

v_GS_COMPUTER_SYSTEM.Manufacturer0 AS [Manufacturer],

v_GS_COMPUTER_SYSTEM.Model0 AS [Model],

v_GS_X86_PC_MEMORY.TotalPhysicalMemory0 AS [Memory (KBytes)],

v_GS_PROCESSOR.NormSpeed0 AS [Processor (GHz)],

(Select sum(Size0)

from v_GS_LOGICAL_DISK inner join v_FullCollectionMembership on (v_FullCollectionMembership.ResourceID = v_GS_LOGICAL_DISK.ResourceID )

where v_GS_LOGICAL_DISK.ResourceID =v_R_System_Valid.ResourceID and

v_FullCollectionMembership.CollectionID = @CollectionID) As [Disk Space (MB)],

(Select sum(v_GS_LOGICAL_DISK.FreeSpace0)

from v_GS_LOGICAL_DISK inner join v_FullCollectionMembership on (v_FullCollectionMembership.ResourceID = v_GS_LOGICAL_DISK.ResourceID )

where v_GS_LOGICAL_DISK.ResourceID =v_R_System_Valid.ResourceID and v_FullCollectionMembership.CollectionID = @CollectionID) As [Free Disk Space (MB)]

from v_R_System_Valid

inner join v_GS_OPERATING_SYSTEM on (v_GS_OPERATING_SYSTEM.ResourceID = v_R_System_Valid.ResourceID)

left join v_GS_SYSTEM_ENCLOSURE_UNIQUE on (v_GS_SYSTEM_ENCLOSURE_UNIQUE.ResourceID = v_R_System_Valid.ResourceID)

LEFT join v_GS_COMPUTER_SYSTEM on (v_GS_COMPUTER_SYSTEM.ResourceID = v_R_System_Valid.ResourceID)

inner join v_GS_PC_BIOS on (v_GS_PC_BIOS.ResourceID = v_R_System_Valid.ResourceID)

LEFT join v_GS_X86_PC_MEMORY on (v_GS_X86_PC_MEMORY.ResourceID = v_R_System_Valid.ResourceID)

LEFT join v_GS_PROCESSOR on (v_GS_PROCESSOR.ResourceID = v_R_System_Valid.ResourceID)

inner join v_FullCollectionMembership on (v_FullCollectionMembership.ResourceID = v_R_System_Valid.ResourceID)

left  join v_Site on (v_FullCollectionMembership.SiteCode = v_Site.SiteCode)

LEFT join v_GS_LOGICAL_DISK on (v_GS_LOGICAL_DISK.ResourceID = v_R_System_Valid.ResourceID) and v_GS_LOGICAL_DISK.DeviceID0=SUBSTRING(v_GS_OPERATING_SYSTEM.WindowsDirectory0,1,2)

left join v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP on (v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.ResourceID = v_R_System_Valid.ResourceID)

Where v_FullCollectionMembership.CollectionID = @CollectionID

Order by v_R_System_Valid.Netbios_Name0

6. Click OK and then save the report, you could save it as a new report as well if you like to have the original query left

7. The report will now show the serial number for all computers including Lenovo

Hardware 1a_2

Did you know that you can multi-select topics in the Technet library and export it to a PDF in a very nice format, with table of content and chapters?It is extremely nice for viewing on a tablet on a plane for instance?

I found this nice little feature in the Technet Library which I didn’t have a clue that it was there, I am probably the last person noticing it but if you haven’t used it before you should try it out.

If you click on the Print/Export icon on the top right on Technet you can select the option “Print Multiple Topics”, then you will come to a help page which will help you get started.

printexport1

After that you will get a new bar with options, where you can select Add this topic

printexport2

If I select for instance news in System Center 2012 Configuration Manager what’s new i SP1 chapter and add it to the Server 2012 what is new I already selected before. And when you have added all the topics you want, Click on the “Collection” button.

printexport3

Then you will come to a page where you can see which topics you have selected and which format you want the export in either HTML or PDF

printexport4The end result is amazing! A PDF that you can read on the plane or wherever you like!
Thank you Microsoft Technet for a great feature!!

printexport5

I ran into this issue yesterday where my software updates where all of a sudden not downloaded anymore in the Configuration Manager Console. After applying the update KB2734608 which is required to support updates for Windows 8 / Server 2012, updates may need to be re-downloaded after applying the update.

See this blog post for more details:

Support Tip: Many new revisions of updates may be downloaded by the WSUS server

Yes!
Today two updates was released, one for Configuration Manager 2007 and one for Forefront Endpoint Protection 2010 both of them adds support for Windows 8 and Server 2012 as clients in Configuration Manager 2007 and Forefront Endpoint Protection 2010.
This is great news for customers which haven’t made the switch yet to Configuration Manager 2012 and Endpoint Protection 2012.

The update for Configuration Manager 2007 SP2 can be downloaded here: http://support.microsoft.com/kb/2750782

The update for Forefront Endpoint Protection 2010 update can be downloaded here: http://support.microsoft.com/kb/2758685

The article on the Configuration Manager team blog with more information can be found here: http://blogs.technet.com/b/configmgrteam/archive/2012/10/31/update-on-windows-8-and-windows-server-2012-support-in-cm-and-ep.aspx

Now it is time to implement these updates in my lab environment!

I needed a really simple script/solution to make sure that only tested/certified Computer models are being installed so I created this simple little script for it.

  • It will prompt the user that the computer model isn’t supported
  • Logs the make/model to a log file on a share
  • Fail the task sequence

To keep it simple I use the same query as in the  task sequence to deploy driver packages to sort out if the Computer model is supported by the task sequence. So you can simply copy the query from the Apply driver package step.

verify1

Then I use ServiceUI.exe from MDT 2012 together with a vbscript to prompt the user that the Computer model isn’t supported and write to a log file. ServiceUI.exe is simply brilliant as you can interact with the user from a Task Sequence! Fantastic!

verify3

The Show Dialog step looks like this:

verify5

The log file will contain the following information

verify4

Here is the VBscript, simply change the path to the log file and create the log file as well, the script will not create the log file if it doesn’t exits.

To implement it:

  • Create the group as described above in the Task Sequence
  • Create the WMI conditions
  • Download MDT 2012 to obtain ServiceUI.exe
  • Download the dialog.vbs file and rename it to Dialog.vbs
  • Change the path to the log file(make sure everyone has permissions to the share)
  • Create the text file used as log file.
  • Create  a package in ConfigMgr (no program necessary) with the two files ServiceUI.exe and Showdialog.vbs in the source directory.
  • Create a step to show the dialog, run it from the package created.

The script can also be downloaded here Dialog.vbs

‘Script to prompt the user that the computermodel is not supported and fail the task sequence
‘Written by jorgen @ ccmexec.com
‘log file to be used
strFile = “\\sccm02.demiranda.nu\pkgsource$\log\model.txt”
On Error Resume Next
Set objWMIService = GetObject(”winmgmts:\\.\root\cimv2″)
Set colItems = objWMIService.ExecQuery(”Select * from Win32_ComputerSystem”,,48)
For Each objItem in colItems
strManufacturer = objItem.Manufacturer
strModel = objItem.Model
Next
Set TsProgressUI = CreateObject(”Microsoft.SMS.TsProgressUI”)
TsProgressUI.CloseProgressDialog
‘Write log file
Const ForAppending = 8
set objFSO = CreateObject(”Scripting.FileSystemObject”)
set objFile = objFSO.OpenTextFile(strFile, ForAppending, True)
objFile.WriteLine(”Time Stamp: ” & Now & ” Manufacturer = “& strManufacturer & ” Model = “& strmodel)
objFile.Close
MsgBox “This Computer model is not supported, the installation will be aborted.” &  chr(13) & “Please contact servicedesk for assistance”, 16,”Installation aborted!”
wscript.quit(1)


'Script to prompt the user that the computermodel is not supported and fail the task sequence

'ccmexec.com

'log file to be used

strFile = "\\sccm02.demiranda.nu\pkgsource$\log\model.txt"

On Error Resume Next

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)

For Each objItem in colItems

strManufacturer = objItem.Manufacturer

strModel = objItem.Model

Next

Set TsProgressUI = CreateObject("Microsoft.SMS.TsProgressUI")

TsProgressUI.CloseProgressDialog

'Write log file

Const ForAppending = 8

set objFSO = CreateObject("Scripting.FileSystemObject")

set objFile = objFSO.OpenTextFile(strFile, ForAppending, True)

objFile.WriteLine("Time Stamp: " & Now & " Manufacturer = "& strManufacturer & " Model = "& strmodel)

objFile.Close

MsgBox "This Computer model is not supported, the installation will be aborted." & chr(13) & "Please contact servicedesk for assistance", 16,"Installation aborted!"

wscript.quit(1)

Be sure not to miss the System Center User Group days in Stockholm Sweden on the 21-22 of January. The event will be two days, one day with focus on Datacenter and Private Cloud and one day will focus on Client Management.

I have the great honor of presenting on the Client Management track a session called “Advanced Application Management” :D

The event will host many great speakers like Wally Mead(Microsoft), Johan Arwidmark(MVP), Björn Axell(MVP), Robert Hedblom(MVP), Mikael Nyström(MVP), Anders Bengtsson(Microsoft), Jonny Andersson.

It will be a truly great event be sure not to miss it!!

Registration can be done here: http://www.scug.se/?p=125

All session will be in Swedish except from Wally’s sessions.

I hope to see you all there!