Showing posts with label cached advertisement. Show all posts
Showing posts with label cached advertisement. Show all posts

Tuesday, 1 October 2013

PreCaching Task Sequence on Client Machine - Part 2

Hi,

If you have read through http://poorlycoded.blogspot.com.au/2013/03/precaching-task-sequence-on-client.html and decided you want to know more, well let me try and assist :)

The below script will read from a list of packages and override the content variables for those packages:
sPackageIDs = "ABC12345,ABC98765,ABC00000,ABC111111"
Set objEnv = CreateObject("Microsoft.SMS.TSEnvironment")
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objShell=CreateObject("Wscript.Shell")
Set objDrives=objFSO.Drives

cacheFolder = "\PathToCache"

path = objFSO.GetParentFolderName(WScript.ScriptFullName)


For Each objDrive In objDrives
 If objDrive.DriveType=2 And objDrive.DriveLetter<>"X" Then
  If objFSO.FolderExists(objDrive.DriveLetter & ":\Windows") Then 
   Drive=objDrive.DriveLetter & ":"
  End If 
 End If
Next 

strCache = Drive & cacheFolder
tsEnv2Path = objFSO.Buildpath(path,"tsenv2.exe")


pkgSplit = Split(sPackageIDS,",")

for each pkg in pkgSplit
strPKGVar = "_SMSTS" & pkg
    For Each variable In objEnv.GetVariables 
        if variable = strPKGVar then
            if objFSO.FolderExists(objFSO.BuildPath(strCache,pkg)) then
                objShell.Run(tsEnv2Path & " set " & variable & "=s" & strCache & "\" & pkg & "\",1,true)
        end if
    next

Next 

You can then put this into your task sequence and have those packages overriden by the local, cached         package.Obviously be careful you don't have a format step, otherwise this will all be in vain, and if you cache folder is in a non standard location, perhaps ensure its added to the Safe Folder variable by adding this line, or setting the OSDStateStore variable in your TS.

objEnv("OSDStateStorePath")=strCache


Hope this helps! PS i've knocked together the above script without testing in my lab - so obviously test this   first :)

Tuesday, 27 August 2013

ConfigMgr 2007 - Unknown Computer Deployments 'cached'

Just had a bit of a problem in an old ConfigMgr 2007 environment with an old Operating System Deployment task sequence, advertised to Unknown Computers collection. Unknown computer support was going to be removed from this company.

This manifested itself in the following manner:
  • Old advertisement targeted to Unknown Computers was disabled a number of weeks ago
  • Unknown computers were still picking up this disabled advertisement and attempting to run it
The SMSPXE log would show an unknown computer booting, and being offered a DISABLED advertisement. Which was a source of confusion, to say the least. WDS service was restarted on one of the PSPs to determine if there was any kind of computer records being cached - this did not resolve the issue.

In the end, the fix for this was to force an update of the collection membership of the Unknown Computers collection. After this was forced, unknown computers would not pick up the old (disabled) advertisement, and everything was peachy.

This may be a strange issue isolated to one particular ConfigMgr instance, but thought i'd share in case this helps anyone.I'm assuming that the old advertisement assignment to the unknown computer objects had never been refreshed. However, i would have thought disabling the Advertisement would have gotten past this issue.

 If anyone knows the actual, for-real cause of this, sing out in the comments.