SCCM cache too small for ZTI?

Consider the following scenario:

Issue:  I have a ZTI Task Sequence configured for “Download all prior to execution”.  The Task Sequence references about 17 GB worth of packages, applications and a Windows 7 operating system image.  I target the deployment to a client that has a configured cache size of 8GB.

The result as you might surmise is a failed deployment since the client does not have enough cache space to download the 17GB worth of data needed to start the deployment.

Solution:  A simple VBScript that checks available disk space and (if enough is free) adjusts the SCCM cache size prior to Task Sequence executing.  (Script is at the end of this post)

Create a new Package/program for the script (In my example the package is named FBN_SetClientCache)

Modify the Task Sequence properties to “Run another program first”, selecting your new package/program.

TSPrereq

Now when you deploy the Task Sequence to a machine, the script will run prior to executing the Task Sequence and adjust the cache size so that its large enough to accommodate the deployment.  😉

The Script: (Mind the word wrapping and be sure to adjust the values of free space and cache size to meet your individual need.)

‘==========================================================================

‘ VBScript Source File — Created with SAPIEN Technologies PrimalScript 2012

‘==========================================================================
Dim intFreeSpaceMB, intTotalSpaceMB, intTotalSpaceGB, intFreeSpaceGB

‘ =============================================================================
‘ // Get Total Free Space of C: drive
‘ =============================================================================
GetFreeSpace(“C:”)

‘ =============================================================================
‘ // Get free space in GB
‘ =============================================================================
intTotalSpaceGB = Split(intTotalSpaceMB,”,”)
intFreeSpaceGB = Split(intFreeSpaceMB,”,”)

‘ =============================================================================
‘ If less than 20GB of free space, exit with Error Code
‘ =============================================================================
If intFreeSpaceGB(0) <= 20 Then
 WScript.Quit -100
End If

‘ =============================================================================
‘ //  Set Cache Size
‘ =============================================================================
SetCacheSize 17000

‘ =============================================================================
‘ // If Set Cache Size fails, exit script with Error Code
‘ =============================================================================
If Err.Number <> 0 Then
 WScript.Quit -101
End If
‘ =-=-=-=- FUNCTIONS BELOW =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

‘ =============================================================================
‘ Method:       GetFreeSpace
‘ Description:  Returns value in MB of Disk Size and Free Disk Space
‘ USAGE:  GetFreeSpace(“C:”)
‘ =============================================================================
Sub GetFreeSpace(strDrive)
 strComputer = “.”
 Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
 Set colDisks = objWMIService.ExecQuery _
     (“Select * From Win32_LogicalDisk Where DeviceID = ‘” & strDrive & “‘”)
 For Each objDisk in colDisks
     intFreeSpace = objDisk.FreeSpace
     intTotalSpace = objDisk.Size
     intFreeSpaceKB = FormatNumber(intFreeSpace/1024, 0)
     intTotalSpaceKB = FormatNumber(intTotalSpace/1024, 0)
     intFreeSpaceMB = FormatNumber(intFreeSpaceKB/1024, 0)
     intTotalSpaceMB = FormatNumber(intTotalSpaceKB/1024, 0)
 Next
End Sub
‘ =============================================================================
‘ Method:       SetCacheSize
‘ Description:  Sets SCCM Client Cache Size
‘ USAGE:  SetCacheSize 17000 (sets to 17GB)
‘ =============================================================================
Sub SetCacheSize(size)
    On Error Resume Next
    Dim oUIResManager
    Dim oCache
    Dim oCacheElements

    Set oUIResManager = createobject(“UIResource.UIResourceMgr”)

    If oUIResManager Is Nothing Then
        Exit Sub
    End If

    Set oCache=oUIResManager.GetCacheInfo

    If oCache Is Nothing Then
        Set oUIResManager=Nothing
        Exit Sub
    End If
       
    oCache.TotalSize = size   
    Set oUIResManager=Nothing
    Set oCache=Nothing
End Sub

Advertisements

3 thoughts on “SCCM cache too small for ZTI?

  1. Hi, It seems that when you specify sccm cache TotalSize value larger than 100000, the script returns an error. Value 99999 works but not over that. Stange?

  2. Hmm, not aware of a particular hard limit for cache size but cant rule it our either. How big is the HDD/Free space on the machine you are running it on? Maybe a better question is what would the use case be for having a client cache size of 100GB?

    • Well, basically we need to update the client cache from 5120mb to whatever the hdd has as free space. Push install won’t do that so we need a script. I made a little modification to your script so it calculates free space and divides it by two and sets it as cache TotalSize. In that way our scipt works in every machine without hardcoding the size limit, our client enviroment is very varied when it comes to age of the clients and their HDD sizes. BUT it seems that my modded scipt with TotalSize variable works only in older machines with low disk space 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s