I some times run into problems while installing SW as a part of my Task Sequence.. Now don’t get me wrong, most times the apply software works like a charm, and everything is installed without a glitch. But every now and then, a piece of software comes along that just won’t install as part of the TS.
To name a couple of the more resent ones i encountered, there is Cisco VPN that has a tendency to cut the network connection for just a second during installation, making the TS fail, or Lenovo(IBM) Presentation Director, that has to have an active desktop in order to install correctly.
Now what I do in these cases (or actually always), is to run a script in end of my TS that sets the computer to auto logon as administrator, and then run a different script that takes care of the installations. Ones the software has been installed the script calls shutdown.exe to restart the computer. By doing this I not only get an extra step in the deployment process, that is TS independent, I also make sure that the machine polices are updated (because of the extra boot)
So now to the Step by Step: Note i assume everybody uses MDT integration, and has made a Toolkit Package ( see this entry on this https://blog.ctglobalservices.com/osdeploy/creating-and-using-toolkit-package/)
1: Create the script(here called Finalize.wsf) that will take care of the auto logon an executions of SW script.
___________________________________________________________
<job id="Finalize">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript">
‘ // *************** Script Header ***************
‘ //
‘ // Purpose: perform automatic logon with local administrator and run scripts
‘ //
‘ // Usage: cscript Finalize.wsf
‘ //
‘ // Coretech History:
‘ // 1.0.0 Michael Petersen 24/06/2008 Created initial version.
‘ //
‘ // *************** End Header ***************
‘//—————————————————————————-
‘//
‘// Global constant and variable declarations
‘//
‘//—————————————————————————-
Option Explicit
Dim iRetVal
Const WINLOGON = "HKLMSoftwareMicrosoftWindows NTCurrentVersionWinlogon"
Const RUN_ONCE = "HKLMSoftwareMicrosoftWindowsCurrentVersionRunOnce"
Dim sPostInstallFolder
Dim sAdministrator
Dim sPassword
Dim sDomain
Dim sFile
Dim sComputer
DIM sScriptRoot
Dim env
Set env = CreateObject("Microsoft.SMS.TSEnvironment")
sPassword = env("APW") ‘ APW is set on deployment collection and must be the local admin password. Can also be hardcoded here.
sAdministrator = "administrator"
sComputer = env("OSDcomputername")
sDomain = env("UserDomain")
sScriptRoot = env("ScriptRoot")
‘ Place to put the postinstallation script.
sPostInstallFolder = "c:windowstemp"
‘//—————————————————————————-
‘// 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()
On Error Resume Next
iRetVal = Success
ZTIProcess = iRetval
‘//—————————————————————————-
‘// Copy Post script to disk, Update RunOnce and change login settings.
‘//—————————————————————————-
For Each sFile in Array("PostInstall.vbs")
If oFSO.FileExists(sScriptRoot & "" & sFile) then
oLogging.CreateEntry "Copying " & sScriptRoot & "" & sFile & " to " & sPostInstallFolder & sFile, LogTypeInfo
oFSO.CopyFile sScriptRoot & "" & sFile, sPostInstallFolder & sFile, true
oLogging.CreateEntry "Updating RunOnce to" & RUN_ONCE & sPostInstallFolder & sFile, LogTypeInfo
oShell.RegWrite RUN_ONCE & sFile, sPostInstallFolder & sFile,"REG_SZ"
‘change login settings.
oShell.RegWrite WINLOGON & "AutoAdminLogon", "1", "REG_SZ"
oShell.RegWrite WINLOGON & "DefaultUserName", sAdministrator, "REG_SZ"
oShell.RegWrite WINLOGON & "DefaultDomainName", sComputer, "REG_SZ"
oShell.RegWrite WINLOGON & "DefaultPassword", sPassword, "REG_SZ"
oShell.RegWrite WINLOGON & "AutoLogonCount", "1", "REG_DWORD"
oShell.RegWrite WINLOGON & "DisableCAD", "1", "REG_DWORD"
oLogging.CreateEntry "Made changes to Logon settings ", LogTypeInfo
Else
oLogging.CreateEntry "Unable to copy script " & sFile & " from " & sScriptRoot & " because it does not exist.", LogTypeInfo
End If
Next �
oLogging.CreateEntry oUtility.ScriptName & " COMPLETED. Return Value = " & iRetVal, LogTypeInfo
End Function
</script>
</job>
_____________________________________________________________________
This script will look trough you Toolkit scripts folder and add all scripts defined in the array to RUN ONCE as well as copy them to the computer (in this case C:\windows\temp). It will the update the registry to do one administrative logon.
2. Create a script (here called Postinstall.vbs) to handle the software installation, and remember to have the script call SHOTDOWN.EXE as the final step. The script here checks if Presentation Director software is present, runs it, and then reboots the machine.
_____________________________________________________________________________
Set oShell = CreateObject("WScript.Shell")
Set oFso = CreateObject("Scripting.FileSystemObject")
If oFso.FileExists("C:\drivers\ThinkVantage\PDIRECT.exe") Then
oShell.Run "C:\drivers\ThinkVantage\PDIRECT.exe /s",0,true
End If
oShell.Run "C:\Windows\system32\shutdown -r -f -c ""OS Deployment done, Performing final reboot..."" -t 5",1,False
________________________________________________________________________
The software you want to install must of cause be present on the computer. Remember that the TS has finished at this point and we can not access the sw trough the DP any more. You can either add the software using a Data Image which i will explain in my next post, have it present in your driver package, if you use the DriverPaths1 method https://blog.ctglobalservices.com/osdeploy/drivers/using-bddmdt-driverpaths1-in-sccm/, append it directly to the master image, or copy it during the TS.
3. Place both scripts Finalize.wsf and Postinstall.vbs in your toolkit script folder.
4.Add a step at the end of you task sequence to run the the Finalize.wsf script (Remember to put in a Toolkit step)
Just type cscript.exe “%ScriptRoot%\Finalize.wsf” in a Run Command Line, and the Postinstall.vbs script should be run post TS.
____________________-
[…] Install software after TS finishes, but as part of the deployment b…/b […]
[…] news by Michael Petersen « CompTIA Training » Data Backup Software Can Save You Time And Money Home Theater […]
[…] Install software after TS finishes, but as part of the deployment … […]
I attempted the code above on a Windows 7 x64 enterprise deployment, during the task sequence i checked the registry and found that the changes have been applied, but after a reboot there is no autologon and the registry changes where gone?
Any ideas?
Can you repost the autologin script? the section where it was to be displayed is blank, although I see your postinstall.vbs just fine.
Thank you
Nice script!
Did some changes, by the way It is not a good idë pasting code in a page like this, people copying the code needs to do a lot of changes.
changed all the ” and ‘
Changed also the following path to the postinstall.vbs script file (there might be another way of doing this but this worked for me):
If oFSO.FileExists(sScriptRoot & “” & sFile) then
wscript.echo sScriptRoot
oLogging.CreateEntry “Copying ” & sScriptRoot & “” & sFile & ” to ” & sPostInstallFolder & sFile, LogTypeInfo
oFSO.CopyFile sScriptRoot & “” & sFile, sPostInstallFolder & sFile, true
Also this needs to be removed: �
My brother suggested I would possibly like this weeb site.
He used to bbe totally right. This post truly made mmy day.
You cann’t believe just how so much time I had spent for this information! Thank you!
Stop by my blog post spanish jokes funny
Cool blog post, thanks!
I ran into the same issue you mentioned with Cisco VPN client installation and used a simpler workaround. Instead of invoking the Cisco installer via command line in my MDT Application, I solved the problem by invoking an old-school batch script that lives in the same folder as the VPN Client Application files in the deployment share.
InstallVPNClient.cmd
————————-
@echo off
echo Copying VPN Client installation files to machine…
xcopy *.* “C:Delete MeVPNClient” /C/H/Q/Z/Y
echo
echo Launching VPN Client Installer…
START “VPN Client Install” /WAIT msiexec.exe /i “C:Delete MeVPNClientvpnclient_setup.msi” /qb- REBOOT=ReallySuppress
echo VPN Client Installed
xcopy Profiles “C:program files (x86)cisco systemsvpn clientProfiles” /E/C/I/Q/H/Z/Y
echo Profiles Copied – Installation Complete
ping localhost >nul
exit
Since the batch file copies all installation files to a temp folder on the machine first, THEN launches the install from local storage, the momentary disruption of network connectivity doesn’t cause a problem. The task sequence continues without trouble.
Thought I’d share for any others searching for a workaround for this specific application issue.