'
' @return The operating system major version number.
'
' @param strComputer if provided, then get the version of the remote
' computer, if not provided then get the OS version of this computer.
'
' @version 1.0
' @author Alan Hoyt
' @bug XMAP-4180
'
function GetOSversion(strComputer)
Dim objWMI, objItem, colItems
Dim version
' Here is where we interrogate the Operating System'
On Error Resume Next
version = "0"
' I took this code from http://www.computerperformance.co.uk/ezine/ezine52.htm and modified
' it for our purposes.
if( strComputer = "" ) then
' Get the OS Version from this computer.
strComputer = "."
end if
' This is where WMI interrogates the operating system
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMI.ExecQuery("Select * From win32_operatingsystem")
' Here we filter Version from the dozens of properties
For Each objItem in colItems
version = Left(objItem.Version,1)
Next
GetOSversion = CInt(version)
end function
'
' @return True if the given registry value contain information or False otherwise.
'
' @param strKey Is the path to the registry key that may or may not contain data, or may or may not
' exist.
'
' @param strValueName The name of the registry value to check.
'
' @param strComputer The name of the computer to check for the value on. WMI
' has to be working and available for this to work. This can be an empty string
' or nothing. If empty then we just check the local registry for the value.
'
' @version 1.0
' @author Alan Hoyt
' @bug XMAP-4180
'
function HasValue(nRoot, strKey, strValueName, strComputer)
On Error Resume Next
if( strComputer = "" ) then
strComputer = "."
end if
Dim strValue
Dim strMsg
Dim objReg
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
If Err.Number <> 0 Then
strMsg = "There was a problem connecting to " _
& strComputer & "\root\default:StdRegProv" & VbCrLf _
& "Error " & Err.Number & " " & Err.description
WScript.StdOut.Write strMsg
WScript.Quit(1)
End If
if( GetOSversion(strComputer) > XP_MAJOR_VERSION ) then
' .NET is installed by default on Vista and newer operating systems.
DotNetIsInstalled = True
end if
end function
'
' @return True if the Visual C++ Redistributable is installed or False otherwise.
'
'
' @version 1.0
' @author Alan Hoyt
' @bug XMAP-4180
'
function VisualStudioRedistIsInstalled(strComputer)
'
' @return True if the SQL Server Express 2005 SP2 is installed, or False otherwise.
'
'
' @version 1.0
' @author Alan Hoyt
' @bug XMAP-4180
'
function SQLserverIsInstalled(strComputer)
if( HasValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Microsoft SQL Server\XMAP5\MSSQLServer\CurrentVersion", "CurrentVersion", strComputer) ) then
SQLserverIsInstalled = True
Exit Function
end if
if( HasValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Microsoft SQL Server\XMAP6\MSSQLServer\CurrentVersion", "CurrentVersion", strComputer) ) then
SQLserverIsInstalled = True
Exit Function
end if
SQLserverIsInstalled = False
end function
'
' @return True if the customer has chosen to install SQL Server, or False otherwise.
'
'
' @version 1.0
' @author Alan Hoyt
' @bug XMAP-4180
'
function InstallingSQLserver(strPrerequisitePath)
Dim fileSystem
Dim strPath
Dim iniStream
Dim strLine
Dim installingSQLpattern
set fileSystem = wscript.CreateObject("Scripting.FileSystemObject")
strPath = fileSystem.BuildPath(strPath, "Setup.ini")
On Error Resume Next
set iniStream = fileSystem.OpenTextFile(strPath, 1, False)
if iniStream Is Nothing then
wscript.StdOut.WriteLine("Failed to open " & strPath & " for reading.")
wscript.Quit(1)
end if
set installingSQLpattern = new RegExp
' The customer chooses to install SQL server by having the PreReq<N>=Microsoft SQL Server... line
' in the prerequisiste installer as not commented out. If the customer does not want SQL server
' installed then they simply add a ';' to the start of the Microsoft SQL server line in the Setup.ini
' file in the Prerequisite installer media folder.
installingSQLpattern.Pattern = "^PreReq\d*=Microsoft SQL Server"
installingSQLpattern.IgnoreCase = True
Do While iniStream.AtEndOfStream <> True
strLine = iniStream.ReadLine()
if( installIngSqlpattern.Test(strLine) = True ) then
iniStream.Close
InstallingSQLserver = True
Exit Function
end if
Loop
iniStream.Close
InstallingSQLserver = False
end function
'
' @return True if all the prerequisites are installed, or False otherwise.
'
' Combines all the functions for checking each prerequisiste into one function to make it
' easy to deal with.
'
' @version 1.0
' @author Alan Hoyt
' @bug XMAP-4180
'
function ArePrerequisitesInstalled(strPrerequisitePath, strComputer)
if( DotNetIsInstalled(strComputer) = False ) then
ArePrerequisitesInstalled = False
Exit Function
elseif (VisualStudioRedistIsInstalled(strComputer) = False ) then
ArePrerequisitesInstalled = False
Exit Function
elseif(InstallingSQLserver(strPrerequisitePath) = True And SQLserverIsInstalled(strComputer) = False) then
ArePrerequisitesInstalled = False
Exit Function
end if
ArePrerequisitesInstalled = True
end function
' ******************************************************************************************
' * MAIN
' ******************************************************************************************
DIM USAGE
DIM nArgumentCount
DIM strPrerequisitePath
DIM shell
On Error Resume Next
USAGE = _
"Usage: RunPrerequisites <path to setup.exe> [computer]" & vbCrLf _
& " <path to setup.exe> := This should be a fully qualified path " & vbCrLf _
& " to the prerequisites.exe on a network share that has read " & vbCrLf _
& " and execute permissions for Everyone." & vbCrLf _
& " [computer] := This is an optional parameter that specifies the remote computer "& vbCrLf _
& " to check to see if the prerequisites are isntalled. This performs a check only, " & vbCrLf _
& " no action is taken when the parameter is provided." & vbCrLf & vbCrLf
nArgumentCount = wscript.Arguments.Count()
if( nArgumentCount < 1 ) then
wscript.StdOut.WriteLine(USAGE)
wscript.Quit(1)
end if
strPrerequisitePath = wscript.Arguments(0)
set shell = wscript.CreateObject("wscript.shell")
DIM fileSystem
Dim strComputer
strComputer = ""
if( nArgumentCount > 1 ) then
strComputer = wscript.Arguments(1)
else
strComputer = "."
end if
set fileSystem = wscript.CreateObject("Scripting.FileSystemObject")
if fileSystem.FileExists(strPrerequisitePath) = False Then
wscript.StdOut.WriteLine( strPrerequisitePath & "Does not exist." & vbCrLf _
& USAGE)
if bInstalled = True then
wscript.StdOut.WriteLine "The prerequisites are installed."
wscript.Quit(0)
else
wscript.StdOut.WriteLine "The prerequisites are not installed."
end if
if( nArgumentCount > 1 ) then
' We are just testing to see if prerequisites are installed or not, so do not continue
' any further in the script.
wscript.Quit(1)
end if
err.Clear
' Run the prerequisite here Remember to test a failure and success
' scenario.
Install the Prerequisites using the script:
CSCRIPT "\\Server\Share\DeLorme\2010\Admin Prerequisites Installer\RunPrerequisites.vbs" "\\Server\Share\DeLorme\2010\Admin Prerequisites Installer\prerequisites.exe"
Then install the Program using standard MSI switches:
"\\Server\Share\DeLorme\2010\DeLorme Street Atlas USA 2010.msi" /l*v "C:\temp\bgsetupDELORME2010.txt" /qn TRANSFORMS="\\Server\Share\DeLorme\2010\Transforms.mst"
Questions & Answers related to DeLorme Publishing DeLorme Street Atlas USA 2010 Network
Blogs (0)
Blog posts related to DeLorme Publishing DeLorme Street Atlas USA 2010 Network
Links (0)
Links related to DeLorme Publishing DeLorme Street Atlas USA 2010 Network
Reviews (0)
Reviews related to DeLorme Publishing DeLorme Street Atlas USA 2010 Network
This website uses cookies.
By continuing to use this site and/or clicking the "Accept" button you are providing consent
Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our
websites or when you do business with us. For more information about our
Privacy Policy and our data protection
efforts, please visit
GDPR-HQ