Tuesday, September 30, 2008

query collection based on file existing on machine

At my company we wanted to create a system where developers could opt in to receive a copy of the nightly build of the software they were working on. In the first part of this project we create a collection based on the software inventory of a particular file. By default SCCM looks for any *.exe's on client systems. Rather than add another file type, we created a dummy exe as the criteria for our collection:
Criterion Type: Simple Value
Where: Software Files – File Name
Operator: is equal to
Value: Filename.exe

Equilivent in wql:

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_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SoftwareFile.FileName = "Filename.exe"

Sunday, September 28, 2008

SCCM MindMap

I've been very busy this past week updating or SCCM environment to SP1.  We want to be at SP1 before we start updating clients from SMS 2003.  During the process I've been helping another admin learn some of the in's and out's of SCCM.  To help I put together a quick mindmap that will help people new to SCCM wrap their heads around it.  You can create your own mindmap at http://www.text2mindmap.com/ .












If you like my list and want to add to it:
SCCM
Software Distribution
Packages
Source
Refresh Distribution Point
Programs
Advertisments
Available
Mandatory
Expires
Collections
Static
Dynamic
Software Updates
Updates lists
Deployment Templates
Deployment Management
Deployment Packages
OSD
Tasks
Drivers

Friday, September 19, 2008

Clients Do Not Run Mandatory Advertisements and They Return Status Message 10052

Yesterday I created a program for a package and advertised it to some test machines.  The package was pretty small so I decided to use the download and run option instead of my normal run from Distribution Point.  Everything else I did the same way I normally do.  To my surprise the program refused to run on the clients.  Checking the Advertisment Status logs I found the error being returned by the clients:  10052 The program for the advertisement "advertisementID" ("packageID" - "program_name") could not be run because the policy contains an invalid combination of requirements: site_code. Possible causes: The program is set to run when no user is logged on, but is being advertised to a user. The program is set to require user input, but does not require that a user be logged on in order to run. Solution: Examine the properties of the program to resolve the conflicting requirements.  I found out that setting the client to download and run, and requires a mapped drive letter will trigger this error message.  No need to map a drive letter if the content is already on the machine!  Anyway here is Microsofts KB on the same issue (written for SMS 2003): http://support.microsoft.com/kb/829858

Wednesday, September 17, 2008

Script to Modify SCCM Advertisement

Below is a script I wrote to echo out all the proprieties from an SCCM advertisement.  Then I modified the comment property and saved it back.  You can modify any property you want, but the Mandatory Assignments will be tricker since they are in an Array.

' --- Set Variables
siteName = "tst"
serverName = "SMSSITESERVER"
SMS_AdvertisementID = "tst20408"
Dim replacementScheduleArray()
Dim SMS_ScheduleToken

' --- Create Objects
Set loc = CreateObject("WbemScripting.SWbemLocator")
Set WbemServices = loc.ConnectServer(servername , "root\SMS\site_" & siteName)


smsAdvertisement()

' --- Refresh Package
Function smsAdvertisement()
Set colAdvertisements = WbemServices.ExecQuery("Select * From SMS_Advertisement where AdvertisementID='" & SMS_AdvertisementID & "'")
Set objAdvertisement = WbemServices.Get("SMS_Advertisement.AdvertisementID='" & SMS_AdvertisementID & "'")
Set Advertisement_Properties = objAdvertisement.Properties_ 'get property Set
set AssignedScheduleArray = Advertisement_Properties.Item("AssignedSchedule")

For each Advertisement In colAdvertisements
'Get Info
Wscript.Echo "adname " & Advertisement.AdvertisementName
wscript.echo "ad ID " & Advertisement.AdvertisementID
wscript.echo "ad Flag " & Advertisement.AdvertFlags
wscript.echo "Present Time " & Advertisement.PresentTime
wscript.echo "Present Time enforced? " & Advertisement.PresentTimeEnabled
wscript.echo "TimeFlags Property " & Advertisement.TimeFlags
wscript.echo "Is Assigned Schedule Enabled/active? Must be true for Mandatory True/false " & Advertisement.AssignedScheduleEnabled
wscript.echo "Expiration Time " & Advertisement.ExpirationTime
wscript.echo "Expiration Time Enabled? " & Advertisement.ExpirationTimeEnabled
wscript.echo "Collection ID " & Advertisement.collectionID
wscript.echo "Package ID " & Advertisement.PackageID
wscript.echo "Program Name " & Advertisement.ProgramName


For i = 0 to UBound(AssignedScheduleArray)
Set SMS_ScheduleToken = AssignedScheduleArray(i)
WScript.Echo AssignedScheduleArray.Name & " " & i & ":" & SMS_ScheduleToken.GetObjectText_()
WScript.Echo "Assignment:" & SMS_ScheduleToken.StartTime

Next

'begin modifying:

strNewComment = "Updated by vbs"
Advertisement.Comment = strNewComment

'This next line will modify the Advertisment with settings set in variables above.
Advertisement.Put_

Next 
End Function

Tuesday, September 16, 2008

Scripting SCCM to refresh a package source directory

My company has a need to have a particular package's distribution points update automatically when a file in the package source directory changes. We looked at the package's built in option to automatically update DP's on a schedule. Ultimately, we decided this would not work. We have a very short window to obtain a 4GB updated package source and then distribute that content to clients. If we set the window too small (every 20 minutes), then clients would be mostly locked out from getting content from the DP, since the DP would be constantly updating. If we set it too large, we don't get the content within the targeted time window. Using the SCCM SDK ( http://www.microsoft.com/downloads/details.aspx?FamilyId=064A995F-EF13-4200-81AD-E3AF6218EDCC&displaylang=en ) and information from a post by aparrott on myitforum: http://www.myitforum.com/forums/m_180582/mpage_1/key_/tm.htm#180582 we were able to create our own script that will detect the change and then update the DP. I have a scheduled task that runs every 20 minutes. If the last modified stamp on the text file is different, then the DP's will update. This happens once a day, but I get new content onto the DP's within 25 minutes. Now I just need to delete the old mandatory assignment and create a new one.

Careful of the wordwrap!  I suggest you copy and paste into notepad.
'==========================================================================
'
' VBScript Source File -- Created with PrimalScript.
'
' NAME: SCCM_Refresh_DP_Nightly_Build.vbs
'
' Created by: Bill Phillips, ESRI
' Date: 09/15/2008
'
' COMMENT:
' Run this as a scheduled task under the System account.
' Machine's account must have rights to the shares.
' Example code from: http://www.myitforum.com/forums/m_180582/mpage_1/key_/tm.htm#180582
'==========================================================================

On Error Resume Next

' --- Set Variables
siteName = "tst"
serverName = "SMSSERVER"
SMS_PackageID = "tst00158"

' --- Create Objects
Set loc = CreateObject("WbemScripting.SWbemLocator")
Set WbemServices = loc.ConnectServer(servername , "root\SMS\site_" & siteName)
set FSO=CreateObject("Scripting.FileSystemObject")

CompareFiles()

' --- Compare Files
Function CompareFiles()
Set objSourceBuildNumTextDate = FSO.GetFile ("\\smsserver\source\foo.txt")
Set objDestBuildNumTextDate = FSO.GetFile ("\\dpserver\SMSPKGE$\tst00158\foo.txt")
If not objSourceBuildNumTextDate.DateLastModified = objDestBuildNumTextDate.DateLastModified Then RefreshPKG
End Function

' --- Refresh Package
Function RefreshPKG()
Set packages = WbemServices.ExecQuery("Select * From SMS_Package where PackageID = '" & SMS_PackageID & "'")
For Each package In packages

Package.RefreshPkgSource( )

Next

End Function

Thursday, September 11, 2008

Searching Config Manager Docs on Technet

As many of you know, searching Config Manager documentation on Technet is a PITA! Fortunetly Jeff Gilbert has figured out how to narrow your Technet search down to just the Config Manager docs. http://blogs.technet.com/wemd_ua_-_sms_writing_team/archive/2007/11/07/how-to-more-easily-search-the-configuration-manager-documentation-library-online.aspx
This should make life significantly better. Can't believe I haven't seen this before now.

Wednesday, September 10, 2008

Deployment of Vista msu with License Agreement

Just came accross an issue where Vista will ignore the /quiet option for Wusa.exe if the MSU file (a Vista patch) has a built-in license agreement.  To fix this issue, you must install a hotfix:

Tuesday, September 9, 2008

Deployment of Group Policy Preferences Client Side Extensions

Yesterday my Group Policy Admin asked about deploying the Client Side Extensions (CSE's) for Group Policy Preferences (GPP) to all the machines in our network.  So I started looking into it and must say I'm very dissappointed with Microsofts support for the deployment of CSE's.  Sure CSE's are available in WSUS and therefore available in SCCM.  However, they haven't released CSE's for XP SP3 yet.  Additionally, the CSE's have a prerequisite of XMLLite.  Unbelievably, XMLLite is not available via WSUS.  The work around is to deploy IE7 which includes XMLLite.  All of this is a little confusing so I made a chart:



Basically I'll create 2 seperate collections for XMLLite to deploy it to the machines that require it.  Then I'll use Software Updates to deploy the CSE's.  XP SP3 will just have to wait until Microsoft gets it done.  Hopefully they're working on CSE deployment with XMLlite bundled in.

Friday, September 5, 2008

Config Manager Software Updates

Why is config Manager's software update process so confusing?  Today I finally figured it out.  It's because an advertisement can get content from multiple packages!  Think about it.  In a traditional software distribution you have 3 objects to worry about.
1. Collection - Target computers
2. Package- contains the files and the commands (programs) that you want to distribute to clients and execute.
3. Advertisement- Matches the Package to a collection to execute at a specific time.
Now in a Software Update you have 4 objects:
1. Update list- A type of template its just a simple list of updates worthy of attention.  This is the object that doesn't exist in normal software distribution.  It's designed to make life easier since you can group together updates in a way that fits your business needs.
2. Deployment Templates- A template of settings that may or may not apply to a particular collection.
3. Deployment Package- Very similar to a regular package this item contains the updates but doesn't have any command line options since the sccm client will kick off the wua to do the install.  It is basically just a storage location.
4. Deployments- located under Deployment Management- this is actually just a very special advertisement.  It contains it's own list of updates that are not what necessarily what is in an update list or deployment package.  The reason for my confusion.  Basically it is an independent object that can grab updates from multiple packages.

The basic thing to remember is that adding content to a Deployment Package, does not add that content to the actual Deployment (advertisement).  After updating an existing package the updates must be either added to an existing deployment by dragging an update list onto the deployment, or creating a new deployment.

Best thing about Chrome

Okay, I'm still in love with chrome.  zdnet has a write up about the top 5 things in chrome.  My favorite feature (about:stats) didn't make the list but check the rest out:

Thursday, September 4, 2008

is sccm client backwards compatible with sms 2003

For those of you wondering, the sccm client is not backwards compatible with sms 2003.  However, the sms 2003 client is backwards compatible with a SCCM environment.  Basic rule of thumb regarding SMS/SCCM is that the highest version must be at the top of the hierarchy.  So if your upgrading, you must either upgrade your central site first, or build a new SCCM site and point your sms central site to the SCCM site as its parent.  Then you work your way down the hierarchy upgrading Parent servers, then child servers, and secondary servers.  Never upgrade a server unless the server above it is already upgraded.  Once you've upgraded your entire environment, figure out how clients are going to determine their management server.  After you've put this in place the last thing to upgrade is the client.

Wednesday, September 3, 2008

Google Chrome goals

A lot of people are wondering why in the world would Google want to release a webbrowser?  We already have 4 biggies: IE, Firefox, Opera, and Safari.  A 5th one just further splinters the market and makes life harder on web developers right?  Actually, what Google is trying to do here is increase visibility of the webkit engine that both Chrome and Safari is based upon.  This also happens to be the engine Google has stuck into it's mobile OS Android.  If Google ever wants to see Android succeed, it has to make sure that it displays the web properly.  The only real way to do this, is to get web developers to code and test against it's webkit engine.  By releasing another browser based on webkit, Google may actually increase the overall web presence of webkit and therefore increase usability for it's Android based devices.  I say this is another smart move by Google.

Tuesday, September 2, 2008

Google Chrome

Today Google announced their new Chrome webbrowser.  http://www.google.com/chrome Based on webkit the same engine that powers safari, iphone, and Google's own Android, chrome is a welcome breath of fresh air.  I've been runing Chrome all day so far and found it very usuable.  I'm even blogging this post from within Chrome.  My biggest complaint?  Google should have made an effort to support plugins.  It'd be even better if they could support existing Firefox Plugins.  I simply can't live without Ad-block plus, and after today I'm sure I'll be back to Firefox due to this one shortcoming.

Monday, September 1, 2008

Time to start over

This past week I found out that one of our management servers had sccm installed on the c:\ drive. You'd think there would be a setting to change the storage location so that the program could still run from c:\. Apparently there is no such option. Only option is a site uninstall and reinstall. Of course if you uninstall, you can't reuse the same site code. Doing so would have dire consequenses including corrupting the site database. Digging around I found a nice article by Anthony Clendenen on removing a secondary site in SMS 2003. The steps outlined by Anthony allow reusing the existing site code. I'd previously used this article to remove and reinstall a Primary 2003 site. After looking at some of the registry keys and file folders on my SCCM site install, I decided to try the same steps on my SCCM primary site. Guess what? It works! Here's the article:
http://www.myitforum.com/articles/8/view.asp?id=9472