Deploying IE10 Prereqs with SCCM

Wait…you want to deploy IE 10 to the workstations in your environment? Good for you! Don’t listen to all of the angry tech-bashing of Internet Explorer…I am a proponent.

What’s that you say? You just want to deploy it all willy-nilly without checking to see what is required for a successful install? Silly rabbit.

Why don’t you just back up a second and check out this blog regarding the necessary prereqs (and how to use SCCM to deploy them): http://myitforum.com/myitforumwp/2013/03/16/deploying-ie10-prereqs-for-win7sp1-with-configmgr-2012/

Incrementing Lines in Orchestrator Runbooks

First of all, I love Orchestrator. Like…seriously. If it was able to walk upright and wasn’t so obnoxious at dinners, I may leave my wife for it…however, our relationship will probably go no further than me using it when I need to make my life simpler.

One of these scenarios just came up, as a matter of fact. As you may/may not know from previous posts, I had to migrate data from one SCSM environment to another. Rather than do this manually, I created an ENORMOUS runbook that handled the transfer of all open incidents. That, my friends, is to come in future posts (yes, it must be spread across multiple). For this post, I just wanted to simply display a technique that I used to increment lines in the runbook as to cover an entire list of incidents.

To do this, I first created two text files. One text file contained a single line with then number “1” called Line.txt. The second text file, called Incident.txt, contained a list of IR numbers, one on each line.

Next, I used two Read Line activities from the Text File Management grouping. The first I titled “Increments” and the second “Read Line”.

For the Increments activity, I pointed to the file location, chose ASCII for the file encoding and entered “1” for the line numbers portion. For the Read Line activity, I did the same for the file location and encoding, but for the line numbers I subscribed to the line text published data from the Increments activity.

“This is all good, Jesse, but how does it know to go to the next line?” Please, please practice some patience. I’m getting there.

A couple actions down (it doesn’t matter exactly where, as long as it is after you utilize the data you gather), I created two more activities. The first is a Run .Net Script activity called “Increment Number” in which I ran a Powershell script to bump the number up one (the script is below this paragraph). IMPORTANT: do not forget to add to the Published Data tab (in this case, create a string that has the name NumberString and variable NumberString). 

_______________Increment Number_______________

$ID = {Line text from “Increments”}

$NextNumber = [int]$ID

$NextNumber = $NextNumber +1

$NumberString = $NextNumber.ToString()

__________________________________________________

The next was a Search and Replace Text activity from the Text File Management grouping, which took the line text from Increments and replaced it with the NumberString from the Increment Number script.

Now, with a monitor up front to kick the runbook off as needed, our runbook will successfully move to the next line containing a new IR. Now, back to sleep while this runs…

Changing the Data Location for the SCSM Self-Service Portal

Anybody who has installed and configured the SCSM 2012 Self-Service Portal (henceforth, SSP) has surely had their “adventures.” If you still have hair left in your bloody scalp and are looking for even more abuse, I recommend doing what I did and standing up a new Management Server whilst maintaining the desire to keep the previous SSP in tact.

I suppose I owe a little bit of a backstory. You see, the environment that I came into had moved from SCSM 2010 to SCSM 2012. As you may know, there is no direct and supported migration path between the two. However, the organization insisted that they be migrated instead of standing up a new environment. In the end, this proved to be a costly move as errors were rampant, scripts ran unsuccessfully and the health of the environment was worse than a toddler swapping snot at daycare.

I just realized that this has already became a relatively disgusting post. Rather than erase and rewrite, I will just apologize.

Anyway, all of this babbling is to simply provide you with the registry key that you need to change on your portal server. The key is:

HKLM\SOFTWARE\Microsoft\System Center\2010\Common\Database

You will want to alter the data of these two values:

“DatabaseServerName”=”<CSMDBSERVER\INSTANCE>”

“DatabaseName”=”ServiceManager”

If you are lucky enough to have a fully functional SSP after this change, let me know! I love success stories.

Gathering the Default Printers for Machines in Your Environment

Recently, I was tasked with gathering a list of the default printers for every machine in our environment. However, anyone who has attempted to gather this information remotely understands that gathering the default printer is a difficult task. Typically, the returned value will be empty, causing a panic deep in your core (ok…that was a little too dramatic). Plus, we have to ensure that the user who primarily operates that device is logged in, as the default printer setting is typically defined by the user.

Thank goodness you are brilliant and use SCCM to manage your environment! I’ve always told people that you’re smart…

Essentially, I created two scripts. The first was simply a CMD that ensured the script was launched locally. The second was a Powershell script that queried the default printer of the user and appended the information to a CSV file back on the SCCM server, listing the username and printer. I kept both scripts in the same source directory and created a program for the CMD. Each program was set to run with user’s rights and only when a user is logged on. The deployment was then set to run on next logon.

One catch to the whole thing was that the execution policy on the user machines has to be unrestricted (hence the line written into the first script). The scripts are detailed below. Remember to change the path to the network location in which you want to store the gathered data. Also, ensure that the first line of the PS1 includes and ends after “select name”.

Enjoy!

________________________Printers.CMD________________________

@echo off

cls

Echo Default Printer Query

set cdir=%~dp0.

pushdir %cdir%

powershell.exe -executionpolicy unrestricted -command .\DefaultPrinter.ps1

popd

Exit

________________________DefaultPrinter.ps1________________________

$Printer = Get-WmiObject -namespace root\cimv2 -Query “select * from Win32_Printer Where Default = TRUE” -Impersonation 3 | select name
$env:username+”,”+$Printer.Name | Out-File -append \\<PathToNetworkLocation>\Printers.csv

Moving the ConfigMgr Database to a New SQL Server

Here’s a quicky, while it’s on my mind. You don’t even have to call me the next day.

I needed to migrate the ConfigMgr database from an over-utilized SQL server to a dedicated SQL server for performance reasons. I came across this article describing the steps to take and, though it speaks specifically to SQL Server 2005 and SCCM 2007, the steps are essentially the same.

Click HEEEEEEERE to go THEEEEERRRE.

Please, for the love of everything above or below ground, test this process first.

-JessCCM

 

Total Physical Memory Query

While I’m on the subject of SCCM queries, I would like to post another simple statement that I used to gather machines with less than 2 GB of total physical memory:

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.TotalPhysicalMemory <= 1572864

“Why did he use 1572864?” you ask? “Did he just pound his forehead onto his number pad?” you ponder?

We have a lot of machines that are running on a 32-bit OS. Therefore, Windows will not properly report the actual total physical memory that is installed. Therefore, rather than include a bunch of machines that have 2 GB RAM installed but are reporting, say, 1.75 GB, I chose to query for 1.5 GB (1572864 Bytes, as that is the required measurement).

As always, if you have a better way, I’d love to hear it! Let me know in a comment below!

SCCM Query for Lenovo Model

I would like to begin by apologizing for my absence. We will just say that I have been spending my time “acquiring knowledge” for new posts (a.k.a. I have been absolutely slammed at work). I could go on about how busy I have been, but we all are, so I will spare you the sad violin music and move forward to this fantastic post, along with the 10 others that I have lined up.

During my “quest for knowledge,” I came across a situation where I was asked to gather all of the machines that are Lenovo ThinkCenter M92p. Easy, right? My hardware inventory already pulls “Computer System” information…I’ll just check Resource Explorer for the model and build a query off of that.

Weeeeeeeeellllll, guess what…

We are a Lenovo shop. Anybody who is a Lenovo shop understands that Lenovo will put out what they define as the “version” (e.g. M92p or T430s) and then have literally dozens of variations on the build, each with their own model number. So, for example, you can have 10 M92p machines in your environment, but some are M92p 2988E1U and others are 3218, etc. Guess what shows up under “model” when you query WMI. That’s right…the build type. We actually want to grab the “version” from “Computer System Product.”

SCCM (naturally) does not pull from “Computer System Product” by default. Therefore, go to Administration > Client Settings > Default Client Settings (or whatever custom Client Settings package you use to manage hardware inventory) > Hardware Inventory > Set Classes. There, you can check “Computer System Product (Win32_ComputerSystemProduct)” and select any or all of the subcategories you need (in this case, “Version”). Once the change is made and the next hardware inventory cycle is run, you should see data being pulled for “Computer System Product” and the “Version.”

Now, to create a query and gather all of our M92p machines!

Here is my query:

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM_PRODUCT on SMS_G_System_COMPUTER_SYSTEM_PRODUCT.ResourceID = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM_PRODUCT.Version like “%M92p%”