SCCM 2007

Moving SCCM Packages and Drivers Source Location

I had a situation recently where a server that had the source shares for my Packages and Drivers had to be decommissioned. This initially seemed like an simple task of updating the source location in each package to the new server. However after realising that there were a lot of packages and about 400 drivers I sought a better way. Powershell to the rescue!

The following block of Powershell gets all the drivers and does a search and replace on the server name.

1
2
3
4
$drivers = Get-WmiObject SMS_Driver -Namespace root\SMS\site_LNK
$drivers | ?{$_.ContentSourcePath -like "\\creekserver\*"} | `
%{$_.ContentSourcePath = $_.ContentSourcePath -replace "creekserver", "PRI-SCCM-V01"; $_.Put()}

I did the same for packages:

1
2
3
4
5
6
$packages = Get-WmiObject SMS_Package -Namespace root\SMS\site_LNK
$packages | ?{$_.PkgSourcePath -like "*creekserver*"} | `
%{$_.PkgSourcePath = $_.PkgSourcePath -replace "creekserver","PRI-SCCM-V01"; $_.Put()}
$packages | %{$_.RefreshPkgSource}

Enjoy!

Read more

Installing Lenovo Hotkey Utility in an SCCM Task Sequence

If you’ve ever tried to install the Lenovo Hotkey utility as part of an SCCM Task Sequence you’ll have noticed that no matter how big a tantrum you through it won’t work. Lenovo’s documentation states that you can install the Hotkey utility in an unattended fasion using “Setup.exe /S”. For whatever reason this doesn’t work in a Task Sequence using a standard Package and Program. To get around this do the follow:

  1. Extract the Hotkey utility.
  2. Create a batch file InstallHotkey.cmd with a single line: %~dp0SETUP.EXE /S
  3. Create a standard SCCM package with the source pointing to your extracted hotkey files.
  4. Make sure that InstallHotkey.cmd is in the same dir as Setup.exe
  5. In you Task Sequence add a new “Run Command Line” task.
  6. Set the Package to the Hotkey Package you created in step 4.
  7. In the command line put InstallHotkey.cmd
Read more

Can you use $OEM$ Files with SCCM 2007 OS Deployments?

The answer is yes! My first clue for solving this came from deployvista.com, “Using the $OEM$ folder with SCCM 2007 OS Deployments“. To summarize you need to place your $OEM$ files into C:\_SMSTaskSequence\OSD\$OEM$ in order for Windows Setup to use the files. Here is what I did:

  1. Added my $OEM$ Files to my MDT Settings Package. (The one with unattend.txt, sysprep.inf and customsettings.ini)
  2. Add Z-CONFIG-CopyOEM.wsf to your MDT Source Files package. I’ve provided it below. (Remember to update DP)
  3. In your Task Sequence right before “Setup Windows and ConfigMgr” add a new “Run Command Line” task.
  4. Set the Name to “Copy OEM Files”.
  5. Set the Command Line to “cscript.exe “%deployroot%\scripts\Z-CONFIG-CopyOEM.wsf”.
  6. Click the “Package” checkbox and select your MDT Settings Package.
  7. All Done!

The guts of the script is pretty simple stuff and it works because when you set a Package in a Run Command Line Task the current directory is the path to whatever package you’ve select. In this case the current directory is the MDT Settings package containing our $OEM$ files.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'//----------------------------------------------------------------------------
'//  See if we can find the $OEM$ Directory
'//----------------------------------------------------------------------------
sDest = OEnvironment.GetOSDV4("_SMSTSMDATAPATH") & "\OSD\$OEM$"
oLogging.CreateEntry "$OEM$ Files will be copied to " & sDest, LogTypeInfo
'//----------------------------------------------------------------------------
'//  Make sure the Destination exists
'//----------------------------------------------------------------------------
MKDir sDest
'//----------------------------------------------------------------------------
'//  Get the Source Location and Copy the files
'//----------------------------------------------------------------------------
sSource = oShell.CurrentDirectory & "\$OEM$"
oLogging.CreateEntry "$OEM$ Files will be copied from " & sSource, LogTypeInfo
'Copy the folder
oFSO.CopyFolder sSource, sDest

Download the script here.

Read more