Tailoring the Microsoft Office source wizard action

(imported topic written by SystemAdmin)

All

Below is my action script for fixing my Microsoft Office 2003 patching. It is based off the wizard with a couple subtle tweaks.

However, I need to make a tweak, and I cannot wrap my head around how to do it (still pretty green). If the endpoiunt does not have the source files (C:\Install\Professional), then it should download them to that dierctory. If it DOES have them, i want it to skip that step and not take the resources necessary to download these files (nearly a Gb).

Below is my code. Any help would be fabulous! Thank you


// Set up parameter for new Office source location

parameter “destination_path”="{“C:\Install\Professional”}"

// Set up parameters for file system commands depending on OS

if {name of operating system contains “Win9” OR name of operating system = “WinME”}

parameter “mkdir_command”=“mkdir”

parameter “rmdir_command”=“deltree /Y”

parameter “move_command”=“move”

parameter “xcopy_command”=“xcopy /S /E /Q /Y”

parameter “windows_command”=“command.com /C”

elseif {name of operating system = “WinNT”}

parameter “mkdir_command”=“mkdir”

parameter “rmdir_command”=“rmdir /Q /S”

parameter “move_command”=“move”

parameter “xcopy_command”=“xcopy /S /E /Q”

parameter “windows_command”=“cmd.exe /C”

else

parameter “mkdir_command”=“mkdir”

parameter “rmdir_command”=“rmdir /Q /S”

parameter “move_command”=“move /Y”

parameter “xcopy_command”=“xcopy /S /E /Q /Y”

parameter “windows_command”=“cmd.exe /C”

endif

// Create Destination Folder As Necessary

parameter “clearFolderOK”=“false”

delete __appendfile

delete createFolder.bat

appendfile @echo off

if {not exists folder (parameter “destination_path”)}

if {name of operating system contains “Win9” OR name of operating system = “WinME”}

appendfile for %%x in ({concatenation " " of ("%22" & it & “%22”) of preceding texts whose (it contains “”) of substrings “” of (parameter “destination_path” & “”)}) do {parameter “mkdir_command”} “%%x”

else

appendfile {parameter “mkdir_command”} “{parameter “destination_path”}”

endif

elseif {parameter “clearFolderOK” = “true”}

appendfile {parameter “rmdir_command”} “{parameter “destination_path”}”

appendfile {parameter “mkdir_command”} “{parameter “destination_path”}”

endif

appendfile cls

appendfile exit

move __appendfile createFolder.bat

waithidden {parameter “windows_command”} createFolder.bat

// Make sure enough space for download and moving source files

continue if {(name of drive of client folder of current site = name of drive of folder (parameter “destination_path”) AND free space of drive of client folder of current site > 2898161922) OR (free space of drive of client folder of current site > 1449080961 AND free space of drive of folder (parameter “destination_path”) > 1449080961)}

download http://HDWPBGFX02.hdmc.harley-davidson.com:52311/Uploads/514cd4499807d59214abdfda2e3e3db557b65646/OfficeSource.tmp

continue if {(size of it = 712781030 and sha1 of it = “514cd4499807d59214abdfda2e3e3db557b65646”) of file “OfficeSource.tmp” of folder “__Download”}

// Extract and move archive files to destination

extract OfficeSource.tmp

delete __Download\OfficeSource.tmp

delete moveFiles.bat

delete __appendfile

appendfile @echo off

appendfile {parameter “xcopy_command”} “{pathname of folder “__Download” of client folder of current site}*” “{parameter “destination_path”}”

appendfile {parameter “rmdir_command”} “{pathname of folder “__Download” of client folder of current site}”

appendfile cls

appendfile exit

move __appendfile moveFiles.bat

waithidden {parameter “windows_command”} moveFiles.bat

// Set correct registry key parameters (HKEY_USERS for Win9x/ME, HKEY_CLASSES_ROOT for other OS)

parameter “officeRegKeyName”="{name of key whose (value “ProductName” of it = (value “DisplayName” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall%7b90110409-6000-11D3-8CFE-0150048383C9%7d” of registry) AND value “Language” of it = (value “Language” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall%7b90110409-6000-11D3-8CFE-0150048383C9%7d” of registry)) of (if (exists key “HKEY_CLASSES_ROOT\Installer\Products” of it) then (key “HKEY_CLASSES_ROOT\Installer\Products” of it) else (key “HKEY_USERS.DEFAULT\Software\Microsoft\Installer\Products” of it)) of native registry}"

parameter “officeRegKeyPath”="{if (exists key (“HKEY_CLASSES_ROOT\Installer\Products” & parameter “officeRegKeyName” & “\SourceList”) of native registry) then (“HKEY_CLASSES_ROOT\Installer\Products” & parameter “officeRegKeyName” & “\SourceList”) else (“HKEY_USERS.DEFAULT\Software\Microsoft\Installer\Products” & parameter “officeRegKeyName” & “\SourceList”)}"

// verify new “LastUsedSource” exists and contains right MSI file before changing it

continue if {exists folder (parameter “destination_path”) whose (exists file whose (name of it as string as uppercase = “PRO11.MSI”) of it)}

// Save a copy of current settings before changing it

parameter “backupIndex”="{if (exists key (“HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\OfficeLastUsedSourceBackup”) of registry) then (number of values whose (name of it starts with “LastUsedSource_”) of key “HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\OfficeLastUsedSourceBackup” of registry) else 0}"

regset "

HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\OfficeLastUsedSourceBackup

" “LastUsedSource_{parameter “backupIndex”}”="{escapes of (if exists (values “LastUsedSource” of keys (parameter “officeRegKeyPath”) of native registry) then ( preceding text of first “%00” of (value “LastUsedSource” of key (parameter “officeRegKeyPath”) of native registry as string & “%00”)) else “”)}"

regset "

HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\OfficeLastUsedSourceBackup

" “DeployControl_{parameter “backupIndex”}”="{(if exists (values “DeploymentType” of keys “HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\Office2003Control” of registry) then (value “DeploymentType” of key “HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\Office2003Control” of registry as string) else “”)}"

regset "

HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\OfficeLastUsedSourceBackup

" “LastUsedSourceRegKey_{parameter “backupIndex”}”="{escape of (parameter “officeRegKeyPath”)}"

regset "

HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\OfficeLastUsedSourceBackup

" “DeployControlRegKey_{parameter “backupIndex”}”="{escape of (“HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\Office2003Control”)}"

regset "

HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\OfficeLastUsedSourceBackup

" “BackupTime_{parameter “backupIndex”}”="{now}"

// Set Office deployment control

regset "

HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\Office2003Control

" “DeploymentType”=dword:00000003

// Set LastUsedSource registry value

regset64 “” “LastUsedSource”=“n;13;{escapes of (parameter “destination_path”)}\”

regset64 “” “13”="{escapes of (parameter “destination_path”)}\"

// Save backup of “CDCache” value

regset "

HKEY_LOCAL_MACHINE\Software\BigFix\EnterpriseClient\OfficeLastUsedSourceBackup

" “CDCache_{parameter “backupIndex”}”="{(if exists key (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Delivery%7b90110409-6000-11D3-8CFE-0150048383C9%7d”) whose (exists value “CDCache” of it) of registry then (value “CDCache” of key “HKEY_LOCAL_MACHINE\Software\Microsoft\Office\11.0\Delivery%7b90110409-6000-11D3-8CFE-0150048383C9%7d” of registry as string) else “”)}"

// Set “CDCache” value to 0 if it exists

regset “” “CDCache”=“0”

//downloads and runs transform file .bat

download http://HDWPBGFX02.hdmc.harley-davidson.com:52311/Uploads/2ac0873fe1841ca358215e1f07029a7aa3fad0c2/Office2003Transformbat.tmp

continue if {(size of it = 186 AND sha1 of it = “2ac0873fe1841ca358215e1f07029a7aa3fad0c2”) of file “Office2003Transformbat.tmp” of folder “__Download”}

extract Office2003Transformbat.tmp

wait “{pathname of system folder & “\cmd.exe”}” /Q /C “{(pathname of client folder of current site) & “__Download\Office2003Transform.bat”}”