Capture Task Sequence Logs during OSD

SCCM has this really annoying habit of not keeping TS logs accessible after completing an OSD task sequence. Unfortunately, this also applies when the TS fails. To combat this problem, I implemented the following solution from Steve Rachui, which moves the TS logs to a network share for proper archiving and ease of access.

To do this, I added a new group to my main task sequence called Log Upload. I selected the “Log Upload” group and went to the Options tab, and added a Task Sequence Variable condition wherein we check whether _SMSTSLastActionSucceeded equals false. If so, it executes the group. I added four steps to this group:

  1. Connect to SMSTSLogUploads – This is a Connect to Network Folder step, which connects to a folder on our SAN using our SCCM service account, mapping it to Z:\.
  2. Erase pre-existing folder for machine – This is a Run Command Line step, which executes the following command line step to delete any folder that had already been created for the machine being imaged: cmd.exe /c rd /s /q z:\%_smstsmachinename%%
  3. Create log folder for current machine – This is another Run Command Line step, which creates a folder on the share for the computer currently running the TS: cmd.exe /c md z:\%_smstsmachinename%%
  4. Copy logs to folder – Our last step, also a Run Command Line step, this actually handles the copying of the log files to the newly-created folder: cmd.exe /c copy %_smstslogpath%\*.* z:\%_smstsmachinename%

It’s important to set this whole group to “Continue on Error,” otherwise it will fail if any of the individual steps fail, and report your entire TS execution as a failure. In my first test run, I hadn’t set this option, and the TS failed when it wasn’t able to delete the not-yet-existing folder on the share in step 2. Note that you’ll also want the preceding steps to continue on error as well, otherwise the TS won’t even get to this part on failure.

Next time, I’ll talk about using a script to send an alert email when a task sequence fails!

Posted in osd sccm by Supermark. No Comments

Test Your Command-Line Before Pushing a Package!

SCCM installs software using the local system account. This sometimes presents issues when testing before packaging in SCCM, as there is no straight-forward way to run things as this account. Packaging the software, testing by deploying to a test machine, and waiting for the results can be time-consuming, so here’s an alternative method for testing your command-line as the local system account:

1. You should have PsExec on the test machine (for example, my test machine has it located in C:\Program Files (x86)\PsExec.exe). Open an admin command prompt and navigate to the location of your PsExec.

2. Enter psexec -si cmd.exe to open a command prompt as the local system account. To confirm that you’re running this command prompt as the system, you can use the command whoami. It should return nt authority\system.

3. You can now use your command line installation to run under the same conditions as SCCM!

For even more betterness, you can create a desktop shortcut with the following target (be sure to sub in a valid admin username):

C:\Windows\System32\runas.exe /user:[domain]\[admin account] “c:\program files (x86)\psexec -si cmd.exe”

This will prompt for the admin account’s password, and then launch the system command prompt.

-Derived from Richard Balsley’s post, found here

Posted in sccm by Supermark. No Comments

Deploying Java with SCCM

It took a lot of trial and error, and it’s still not the most efficient method, but here’s how I’ve been able to deploy Java via SCCM 2007:

1. Download the version of Java JRE you want to deploy HERE (specifically, the Offline installer; we use x86 even though we have x64 machines).

2. Run the Java EXE.

3. Find the temp folder it unpacked to (probably C:\Users\%USERNAME%\AppData\LocalLow\Sun\Java for whatever user context you ran it under).

4. Take the MSI in that folder, along with Data1.cab. Put BOTH those in your source folder (it will fail if you don’t copy Data1.cab as well).

5. Create Package from Definition using that MSI.

6. Deploy!

If you have a more efficient method, or any questions, leave a comment!

Posted in sccm by Supermark. No Comments

Changing the Topic.

Suddenly, I have real things to talk about. I stumbled onto the task of managing SCCM for my company, and have learned a LOT. However, as is often the case in Tech, learning is an ongoing process, and “a lot” is a relative term.

As such, I will be posting tips, tricks, and things I learn here for archiving and linking purposes.

Here are some resources I find very helpful:
MyITForum.com – System Center Products
SCCM Guru Webcast Series
Reddit – /r/SCCM

Posted in sccm by Supermark. No Comments