http://psappdeploytoolkit.com/ ‘s wrapper is my new favorite wrapper for applications I add to MDT or SCCM. As Johan & others have stated, the main reason to use wrappers is how mush it eases testing of creating packages. Here are my 2 edits I make to all of my Deploy_Application.ps1 scripts.
1.Tell PSAppDeploy to copy the content (files\) to my local %temp% before installation. This is especially important when installing NetMotion or similar installs that drop the network during installation.
##*===============================================
##* PRE-INSTALLATION
##*===============================================
# ......
## Copy $dirFiles local before running
[string]$Destination = "$envTemp" + [System.IO.Path]::GetRandomFileName()
Try {
Show-InstallationProgress -StatusMessage "Copying files locally. Please wait…"
Copy-File -Path "$dirFiles" -Destination "$Destination" -Recurse
Execute-Process -Path "icacls.exe" -Parameters """$Destination"" /grant ""Everyone:(OI)(CI)(F)"" /t"
[string]$dirFiles = $Destination
}
Catch {
$InstallPromptErrMsg = "There was an error in copying the install files local. `n$(Resolve-Error)"
Write-Log -Message $InstallPromptErrMsg -Severity 3 -Source $appDeployToolkitName
Show-DialogBox -Text $InstallPromptErrMsg -Icon "Stop"
Exit
}
i.e. using localized $dirFiles:
Execute-Process -Path "cscript.exe" -Parameters """$dirFiles\LocalGPO\LocalGPO.wsf"" /Path:""$dirFiles\{AAF84CEF-E7E2-4394-9732-EE74A8FDE474}""" -WorkingDirectory "$dirFiles\LocalGPO"
2.Clean-up the temp location.
##*===============================================
##* POST-INSTALLATION
##*===============================================
[string]$installPhase = 'Post-Installation'
## <Perform Post-Installation tasks here>
# Delete local copy of $dirFiles
Show-InstallationProgress -StatusMessage "Performing clean up routine. This may take some time. Please wait..."
Remove-File -Path "$dirFiles" -Recurse
/BG