Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start Up Script Slow -- Wanting to Speed it Up

Status
Not open for further replies.

thec0dy

IS-IT--Management
Apr 16, 2010
41
US
I have this script below that will install software or upgrade that software depending on what the script finds. Before the user can login it, if the computer does not have the software, or needs to have it upgraded then it takes forever to get the login box due to it saying running start up scripts. I was wondering if there is anything below that can be tweaked that will make the script run, but also make sure that both .MSI files run after the other. The xcopy files will need to be transfered first to ensure the setup can launch. Any suggestions? Thanks!


Set wshShell = WScript.CreateObject("WSCript.shell")
Dim returnval
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
strOS = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName")
If strOS = "Microsoft Windows XP" or Left(strOS,9) = "Windows 7 Professional" Then

'*********************************************************************************
'Lets Check for GEdge and see if it is installed. If not, lets install it.
'*********************************************************************************
If strOS = "Microsoft Windows XP" Then
If Not RegKeyExists("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7EDD1CCA-F75D-4DB2-A958-B2E83C840EAF}") Then
wshShell.Run "xcopy ""\\server\deploy$\GEdge\GEdge Framework Client.msi"" C:\Install\GEdge\ /Y",0,True
wshShell.Run "xcopy ""\\server\deploy$\GEdge\GEdge Hard Disk Client.msi"" C:\Install\GEdge\ /Y",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Framework Client.msi"" /q REBOOT=ReallySuppress",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Hard Disk Client.msi"" /q REBOOT=ReallySuppress",0
Else

'**************************************************************************************************************
'Lets check if the version is current, if not lets upgrade - Version must be changed below in quotes. "9.5.0"
'**************************************************************************************************************
returnval= WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\GE\Framework\ProductVersion")
If instr(returnval, "9.5.0") > 0 then
'---=== Version is recent, so lets do nothing. Have a great day!
Wscript.Quit
Else
'---=== Let's update this GEdge
wshShell.Run "xcopy ""\\server\deploy$\GuardianEdge\GuardianEdge Framework Client.msi"" C:\Install\GuardianEdge\ /Y",0,True
wshShell.Run "xcopy ""\\server\deploy$\GEdge\GEdge Hard Disk Client.msi"" C:\Install\GEdge\ /Y",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Framework Client.msi"" /q REINSTALL=ALL REINSTALLMODE=vomus REBOOT=ReallySuppress",0,True
WshShell.Run "msiexec /i ""C:\Install\GEdge\GEdge Hard Disk Client.msi"" /q REINSTALL=ALL REINSTALLMODE=vomus REBOOT=ReallySuppress",0
End if

End If
End If
End If

Set wshShell = Nothing
Set objWMIService = Nothing

Function RegKeyExists(strName)
Const NO_EXISTING_KEY = "HKEY_NO_EXISTING\Key\"

Dim objWsh
Dim strKeyPath
Dim strNoKeyError

Set objWsh = WScript.CreateObject("WScript.Shell")
strKeyPath = Trim(strName)
If Right(strKeyPath, 1) <> "\" Then strKeyPath = strKeyPath & "\"
On Error Resume Next
' Get the error description by trying to read a non-existent key
objWsh.RegRead NO_EXISTING_KEY
strNoKeyError = Err.Description
Err.Clear
objWsh.RegRead strKeyPath
' Compare the error description with the previous determined sample
If Replace(Err.Description, strKeyPath, _
NO_EXISTING_KEY) = strNoKeyError Then
RegKeyExists = False
Else
RegKeyExists = True
End If
Err.Clear
On Error Goto 0
Set objWsh = Nothing
End Function
 
The biggest thing I see here is that you have to not only wait for the software to install, but you also have to wait for the software to copy. Since this is a startup script, it only applies upon reboot, so move the copy portion as a shutdown script. That way you already have those files on the PC when it starts up.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Thanks Mark, that solution might work, but these files are about 30MB total to download. They would travel across a T1 and I am afraid the users might power the computer off waiting. Installing the files can take up to 10 minutes.

Is there not away to have this process run in the background at startup without waiting for the script to finish? GPO would take 10 minutes and two restarts for it to finish. I am just trying to find a solution that will not hassle the end user.
 
I thought about this, not sure how it would work out or not. What if I converted that VBS script to an EXE file? Would VBS still wait for the .exe finish before startup?
 
You can have the VBS run as a service, thus, processing in the background.

-Geates
 
I still think the biggest bottleneck is the file copying to the PC. Run a script during the day to copy to the PC if you don't want them to wait for logoff, however you have a bigger issue if your users are powering down their PCs since they won't get updates at night then. I would address the training issue with the users and then break the process up between loggoff and logon scripts as I suggested above.

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
why do you need to copy the msi locally before running it?
 
This is encryption software. I wanted to reduce the risk of error by copying it over to the computer before install. It is a two part .msi file. One needs to be installed before the other. So that is why I want to copy it over first. There are about 450 computers that get this install package. I have been using PSEXEC before to manually do it, but once I got them all installed, I wanted something that I could use to upgrade them, and install the software to new computers when they were added to the domain.
 
its fairly rare that there is need to copy an msi locally before installing it. leave it up on your file server i would say.
audit your logon script in both cases (one when you copy down, one when you dont)...use the one which is quickest.



its already been suggested but you might consider spawning a seperate thread 'install_software.vbs' and not waiting for this to finish before allowing your logon script to finish. you then run into issues with users starting up apps which your MSI installs in the background wont like etc...but thats a different issue.
 
Could I compile the vbs into an exe file so it only runs that file once then executes in the background so the user does not have to wait a long time before they can login?
 
I use ScriptCryptor to convert VBS to EXE. You can also use Visual Studio VB.Net Express to do it. The latter is free from MS.

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top