CCMEXEC.COM – System Center blog

CCMEXEC.COM – by Jörgen Nilsson

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!

The Orchestrator integration in MDT 2012 Update 1 is my new toy for this week, it feels like Christmas when you where a little kid you want to play around with it all the time, have it next to the bed at night!

I wrote a blog post a couple of days ago on how to use the Orchestrator integration in MDT 2012 Update 1 to remove the computer from a Collection after a successful OS deployment.
I wrote in that post that you could use it to send an email if the deployment is not successful and it is just as simple. The end result will look like this, where we include the computername and as it is possible to pass variables on to Orchestrator we also use the setting for where the Log files are located for the failed OS deployment.

Orch2_4

Here is how to do it:

Environment prerequisites:

  • Configuration Manager 2012 site configured for OSD
  • MDT 2012 Update 1
  • The Network Access account need to have permissions to execute the Runbook

1. First we create a Runbook with two really simple steps.
Orch2_1 2. The initialize step has the following two variables:

Orch2_2

3. The Send Email step has the following settings in the text, it is necessary to configure SMTP server settings on the other tabs as well. To use the variables in the subject and message use right-click and select Subscribe / Published Data and select “OSDComputerName” in the list so the same in the Message box where we also include the path to the log file as well.

Orch2_5
4. In the SCCM 2012 MDT Task sequence we add a step in the end of the Task Sequence under the “Gather Logs and StateStore on Failure” with the following settings and again it is so easy, just type in the Orchestrator servername and you will be presented with a list of Runbooks to chose from. Chose the one we created and add the following variables to pass on to it.

Orch2_6Finished!

If you need to fail the task sequence for testing add a run command line running a vbscript with the following content, which will simply return an exit code of 1. Which indicates a failure.

Wscript.quit(1)

Next up create an incident in Service Manager if the OS deployment fails which is also really easy to do.

Start testing it yourself!

Today I got the MVP Award mail! It was a long day of waiting, checking the junk mail filter, checking that the mailbox wasn’t full and then finally the mail arrived. :D

“Dear Jorgen Nilsson,

Congratulations! We are pleased to present you with the 2012 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in System Center Configuration Manager technical communities during the past year.

Thank you Microsoft for presenting me with this award, it is a true honor! Thanks to all of you who inspired me with interesting scenarios and challenging questions!

/Jörgen