To add the ZTERemoveCompression.wsf script to your scripts folder as an accessible script
1. | Copy & Paste the code below the —Code Snippet— below in this article into a blank text file and save it as ZTERemoveCompression.wsf. |
2. | Copy or Move the ZTERemoveCompression.wsf script to your scripts folder under your distribution share. (Ex: \\server1\distribution$\scripts\ZTERemoveCompression.wsf) |
To add the ZTERemoveCompression.wsf script as a task to the task sequence of a build
1. | Start Deployment Workbench. | ||||||||
2. | In the console tree, navigate to Builds. | ||||||||
3. | In the details pane, right-click build (where build is the build whose task sequence you want to modify), and then click Properties. | ||||||||
4. | Click the Task Sequence tab, navigate to Non-OSD Refresh Onlye group, click Add, and then click Task. Note Ensure that you add the task prior to the Apply Windows PE task so that the drive compression is removed before winpe gets applied locally. | ||||||||
5. | Complete the Properties tab of the new task by using the information in the table below, accepting default values if not otherwise specified, and then click Apply. Completing the Properties Tab of the New Task
| ||||||||
6. | Complete the Options tab of the new task by using the information in the table below, accepting default values if not otherwise specified, and then click OK. Completing the Options Tab of the New Task
|
Upon completion of adding the task to run the ZTERemoveCompression.wsf script, the C: drive will now have its compression removed beforeWinPE gets applied in a refresh scenario.
–Code Snippet–
' //***************************************************************************
' // ***** Script Header *****
' //
' // Solution: Solution Accelerator MOD for Business Desktop Deployment
' // File: ZTERemoveCompression.wsf
' //
' // Purpose: To remove the compression from the system drive before applying WinPE.
' //
' // Usage: cscript ZTERemoveCompression.wsf [/debug:true]
' //
' // Customer Script Version: 1.0.0
' //
' // Extension History:
' // 1.0.0 JOS 4/03/2007 Created initial version.
' //
' // Customer History:
' //
' // ***** End Header *****
' //***************************************************************************
'//----------------------------------------------------------------------------
'//
'// Global constant and variable declarations
'//
'//----------------------------------------------------------------------------
Option Explicit
Dim iRetVal
'//----------------------------------------------------------------------------
'// End declarations
'//----------------------------------------------------------------------------
'//----------------------------------------------------------------------------
'// Main routine
'//----------------------------------------------------------------------------
On Error Resume Next
iRetVal = ZTIProcess
ProcessResults iRetVal
On Error Goto 0
'//---------------------------------------------------------------------------
'//
'// Function: ZTIProcess()
'//
'// Input: None
'//
'// Return: Success - 0
'// Failure - non-zero
'//
'// Purpose: Perform main ZTI processing
'//
'//---------------------------------------------------------------------------
Function ZTIProcess()
iRetVal = Success
Dim sCmd, objExec, sCheckCompressOut, sUnCompressOut, sCheckOutString, sUnOutString, bFoundSuccess, bFoundCompress
bFoundSuccess = False
bFoundCompress = False
oLogging.CreateEntry "Checking to see if the C drive is compressed.", LogTypeInfo
sCmd = "compact c:"
Set objExec = oShell.Exec(sCmd)
sCheckCompressOut = Split(objExec.StdOut.ReadAll, vbNewLine)
' Loop through all output returned and find if a string states that files will be compressed.
For Each sCheckOutString In sCheckCompressOut
If InStr(sCheckOutString, "will be compressed") > 0 Then
oLogging.CreateEntry "Compression is enabled on the C: drive, attempting to remove compression.", LogTypeInfo
sCmd = "compact c: /u"
Set objExec = oShell.Exec(sCmd)
iRetVal = objExec.ExitCode
sUnCompressOut = Split(objExec.StdOut.ReadAll, vbNewLine)
For each sUnOutString in sUnCompressOut
If InStr(sUnOutString, "C:\ not to compress new files [OK]") > 0 Then
oLogging.CreateEntry "Compression successfully removed from C drive.", LogTypeInfo
bFoundSuccess = True
Exit For
End If
Next
bFoundCompress = True
Exit For
End If
Next
If bFoundCompress = True Then
If bFoundSuccess = False Then
oLogging.CreateEntry "Unable to determine if compression was successfully removed from C drive. Exit Code:" & iRetVal, LogTypeInfo
End If
Else
oLogging.CreateEntry "No compression found on drive C, did not attempt to remove.", LogTypeInfo
End If
ZTIProcess = iRetVal
End Function