Option Explicit '------------------------------------------------------------------------------' '- SafeGuard Enterprise Installation script '- jdegon - March 2010 '------------------------------------------------------------------------------' Dim strComputer : strComputer = "." Const HKEY_LOCAL_MACHINE = &H80000002 Dim fso : Set fso = CreateObject("Scripting.FileSystemObject") Dim oShell : Set oShell = CreateObject("WScript.Shell") Dim WshNetwork : Set WshNetwork = WScript.CreateObject("WScript.Network") Dim oReg : Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") Dim objWMIService : Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Dim objBitService : Set objBitService = GetObject("winmgmts:{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" & strComputer & "\root\cimv2") Dim colComputer : Set colComputer = objWMIService.ExecQuery("Select * from Win32_ComputerSystem") Dim objWMI : Set objWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2") Dim oWMI : Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\.\root\cimv2") Dim objLogicalDisk : Set objLogicalDisk = objWMI.Get("Win32_LogicalDisk.DeviceID='c:'") ' Dim LogFileLocation : LogFileLocation = fso.GetParentFolderName(WScript.ScriptFullName) Dim LogFileLocation : LogFileLocation = "C:" '------------------------------------------------------------------------------' '-- Variables To be Set '-- NOTE: This script is designed so all installation files, including this '-- script are all located within the same directory. '------------------------------------------------------------------------------' '------------------------------------------------------------------------------' '-- Create scripting log file '------------------------------------------------------------------------------' Dim LogFile : LogFile = LogFileLocation & "\SGNInstallationScript.log" Dim ScriptingLog : Set ScriptingLog = fso.createtextfile(LogFile , True) '------------------------------------------------------------------------------' '-- Hide installation folder '------------------------------------------------------------------------------' ' Dim objFolder : Set objFolder = fso.GetFolder(fso.GetParentFolderName(WScript.ScriptFullName)) ' If objFolder.Attributes = 16 Then ' objFolder.Attributes = 18 ' End If '------------------------------------------------------------------------------' '-- Determine Operating System version '------------------------------------------------------------------------------' Dim objWMIRoot : Set objWMIRoot = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Dim colItems : Set colItems = objWMIRoot.ExecQuery("SELECT * FROM Win32_OperatingSystem",,48) Dim objItem For Each objItem in colItems Dim OSVersionWmi : OSVersionWmi = objItem.Version Dim OSVersionSplit : OSVersionSplit = split(OSVersionWmi, ".") Dim OSVer : OSVer = OSVersionSplit(0) Dim OSVerMinor : OSVerMinor = OSVersionSplit(1) ScriptingLog.writeline "Operating System Version: " & OSVersionWMI Next '--------------------------------------------------------------------------' '- Installation MSI's '--------------------------------------------------------------------------' ' - Name of SGxPreinstall MSI ** MSI from the CD or download Dim SGxPreinstallMSILocationFile SGxPreinstallMSILocationFile = chr(34) & fso.GetParentFolderName(WScript.ScriptFullName) & "\Software\SGxClientPreinstall.msi" & Chr(34) ' - Name of SGNClient MSI ** MSI from the CD or download Dim SGNClientMSILocationFile SGNClientMSILocationFile = chr(34) & fso.GetParentFolderName(WScript.ScriptFullName) & "\Software\SGNClient.msi" & Chr(34) ' - Name of Client Configuration file ** MSI created by the SGN Management Center Dim SGNConfigMSILocationFile SGNConfigMSILocationFile = chr(34) & fso.GetParentFolderName(WScript.ScriptFullName) & "\Software\ProdPackage1" & Chr(34) '--------------------------------------------------------------------------' '- Patches - All files are located within the "Patch" directory '--------------------------------------------------------------------------' ' - SGN Client Patch MSP - Fixes SGNMaster crash during shutdown (For 5.40 Only) ' Dim SGNPatchMSPLocationFile ' SGNPatchMSPLocationFile = chr(34) & fso.GetParentFolderName(WScript.ScriptFullName) & "\Patches\5.40.0.152_Patch_SR.msp" & Chr(34) ' - SGN Client Patch sggina.dll - This fixes "show password" issues (For 5.40 Only) ' Dim SGNPatchSGGINALocationFile ' SGNPatchSGGINALocationFile = chr(34) & fso.GetParentFolderName(WScript.ScriptFullName) & "\Patches\sggina.dll" & Chr(34) ' - SGN Client Patch sdxrmdlgs.dll - This fixes "Media Passphrase" issue (For 5.40 DX Only) ' Dim SGNPatchsdxrmdlgsLocationFile ' SGNPatchsdxrmdlgsLocationFile = chr(34) & fso.GetParentFolderName(WScript.ScriptFullName) & "\Patches\sdxrmdlgs.dll" & Chr(34) ' - SGN Client Patch feshellx.dll - This fixes conflict with Acrobat (For 5.40 DX Only) ' Dim SGNPatchfeshellxLocationFile ' SGNPatchfeshellxLocationFile = chr(34) & fso.GetParentFolderName(WScript.ScriptFullName) & "\Patches\feshellx.dll" & Chr(34) '--------------------------------------------------------------------------' '- SGN configuration XML files '--------------------------------------------------------------------------' '- Name of POA XML - Helps create custom installs for computer models Dim SGNPOAXMLLocatoinFile SGNPOAXMLLocatoinFile = chr(34) & fso.GetParentFolderName(WScript.ScriptFullName) & "\Software\5_40_0_R6_April.xml" & Chr(34) '- Name of GINA XML - Disables GINA repair feature making reordering of GINA modules possible Dim SGNGINAXMLLocatoinFile SGNGINAXMLLocatoinFile = chr(34) & fso.GetParentFolderName(WScript.ScriptFullName) & "\Software\deactivate_ginachainrepair_Signed.xml" & Chr(34) '------------------------------------------------------------------------------' '- Disk Space Check - used to create custom exit codes. If not using deployment '- software, this section is not required '------------------------------------------------------------------------------' Dim strDisksize : strDisksize = objLogicalDisk.FreeSpace/(1024*1024*1024) If strDisksize < 3 Then ScriptingLog.writeline "Aborting the SGN installation, there only appears to be " & (strDiskSize \1) & " GB Free." 'Msgbox("Aborting the SGN installation, there only appears to be " & (strDiskSize \1) & " GB Free.") Wscript.Quit(1) Else ScriptingLog.writeline "Disk space checked: " & (strDiskSize \1) & " GB Free. -> PASSED" End If '------------------------------------------------------------------------------' '- Memory Check - used to create custom exit codes. If not using deployment '- software, this section is not required '------------------------------------------------------------------------------' Dim objComputer : For Each objComputer in colComputer Dim MemoryInComputer : MemoryInComputer = objComputer.TotalPhysicalMemory/(1024*1024) If MemoryInComputer < 256 Then ScriptingLog.writeline "Aborting the SGN installation. Not enough memory to continue the installation: " & MemoryInComputer & " MB" 'Msgbox("Aborting the SGN installation. Not enough memory to continue the installation: " & MemoryInComputer & " MB") wscript.quit(2) Else ScriptingLog.writeline "Memory checked: " & MemoryInComputer & " MB available. -> PASSED" End If Next '------------------------------------------------------------------------------' '- OS must be 32 bit - used to create custom exit codes. If not using deployment '- software, this section is not required '------------------------------------------------------------------------------' Dim colSettings : Set colSettings = objWMIService.ExecQuery("SELECT * FROM Win32_Processor") Dim objProcessor : For Each objProcessor In colSettings Dim cpuType : cpuType = objProcessor.AddressWidth If cpuType <> 32 Then ScriptingLog.writeline "Installation aborting, SGN 5.50 does not support a 64 bit OS. No changes have been made to your system." Msgbox "Installation aborting, SGN 5.50 does not support a 64 bit OS. No changes have been made to your system.",0,"Safeguard Enterprise Client Installation" wscript.quit(3) Else ScriptingLog.writeline "Operation System is running a 32bit architecture: -> PASSED" End If Next '------------------------------------------------------------------------------' '- Confirming SGN is not already installed - used to create custom exit codes. '- If not using deployment software, this section is not required '------------------------------------------------------------------------------' Dim strSGNPath : strSGNPath = "SOFTWARE\Utimaco\SafeGuard Enterprise" Dim strSGNInstallDirName : strSGNInstallDirName = "SGNInstallDir" Dim strSGNInstallDirValue : oReg.GetStringValue HKEY_LOCAL_MACHINE,strSGNPath,strSGNInstallDirName,strSGNInstallDirValue If IsNull(strSGNInstallDirValue) Then ScriptingLog.writeline "Checking for previous SGN installation: -> PASSED" Else ScriptingLog.writeline "Safeguard Enterise appears the be already installed, installation aborted" Msgbox "Safeguard Enterise appears the be already installed, installation aborted",0,"Safeguard Enterprise Client Installation" wscript.quit(4) End If '------------------------------------------------------------------------------' '-- Check for Pointsec '------------------------------------------------------------------------------' Dim strPointSecPath : strPointSecPath = "SOFTWARE\Pointsec Mobile Tech\Pointsec for PC" Dim strPointSecName : strPointSecName = "Encryption_C" Dim strPointSecValue : oReg.GetStringValue HKEY_LOCAL_MACHINE,strPointSecPath,strPointSecName,strPointSecValue If IsNull(strPointSecValue) Then ScriptingLog.writeline "Checking for previous PointSec installation: -> PASSED" Else ScriptingLog.writeline "PointSec appears the be already installed, installation aborted" Msgbox "PointSec appears the be installed on this system. The installation of SGN will not continue",0,"Safeguard Enterprise Client Installation" wscript.quit(5) End If '------------------------------------------------------------------------------' '- Checking for Pending reboots - used to create custom exit codes. If not using '- deployment software, this section is not required '------------------------------------------------------------------------------' Dim strRenamePath : strRenamePath = "SYSTEM\CurrentControlSet\Control\Session Manager" Dim strRenameName : strRenameName = "PendingFileRenameOperations" Dim strRenameValue : oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,strRenamePath,strRenameName,strRenameValue If IsNull(strRenameValue) Then ScriptingLog.writeline "no pending reboots required: -> PASSED" Else ScriptingLog.writeline "A pending reboot was detected, installation aborted" Msgbox "The Safeguard Enterprise Client installation was stopped." & Chr(13) & Chr(13) & "A pending reboot has been detected, please reboot your computer and try instalation again",0,"Safeguard Enterprise Client Installation" wscript.quit(6) End If '------------------------------------------------------------------------------' '-- Checking Current GINA module '------------------------------------------------------------------------------' Dim strWinLogonPath : strWinLogonPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" Dim strWinLogonName : strWinLogonName = "GinaDLL" Dim strCurrentGinaValue : oReg.GetStringValue HKEY_LOCAL_MACHINE,strWinLogonPath,strWinLogonName,strCurrentGinaValue Dim GinaValue : GinaValue = LCase(strCurrentGinaValue) If IsNull(GinaValue) Then Else ScriptingLog.writeline "An existing GINA module was found: " & GinaValue End if '------------------------------------------------------------------------------' '- Increase IRPStack resource '------------------------------------------------------------------------------' Dim dwStackPath : dwStackPath = "SYSTEM\CurrentControlSet\Services\lanmanserver\parameters" Dim dwStackName : dwStackName = "IRPStackSize" Dim dwStackValue : dwStackValue = "33" oReg.SetDWordValue HKEY_LOCAL_MACHINE,dwStackPath,dwStackName,dwStackValue '------------------------------------------------------------------------------' '- AllocMode - Change the way SGN Kernel installs (recommended) '------------------------------------------------------------------------------' Dim AllocModePath : AllocModePath = "SYSTEM\CurrentControlSet\Control\Session Manager" Dim AllocModeName : AllocModeName = "AllocMode" Dim AllocmodeValue : AllocmodeValue = "1" oReg.SetDWordValue HKEY_LOCAL_MACHINE,AllocModePath,AllocModeName,AllocmodeValue '------------------------------------------------------------------------------' '- Installation of SGN Client - Only one install should be active '------------------------------------------------------------------------------' '------------------------------------------------------------------------------' '- DE & DX modules '------------------------------------------------------------------------------' Dim strLaunchSGNPreinst : strLaunchSGNPreinst = "msiexec /i " & SGxPreinstallMSILocationFile & " /passive /L*v " & Chr(34) & LogFileLocation & "\" & WshNetwork.ComputerName & "_SGNPreinstall.log" & Chr(34) Dim intRetValPreinst : intRetValPreinst = oShell.Run(strLaunchSGNPreinst,1,True) If intRetValPreinst <> 0 Then ScriptingLog.writeline "Installation of SGN Preinstall failed, please see installation log file" Msgbox "The installation of SafeGuard Enterprise Client Preinstall has failed, please contact support for further assistance",0,"Safeguard Enterprise Client Installation" wscript.quit(7) Else ScriptingLog.writeline "Installation of SGN Preinstall was successful" End If Dim strLaunchSGNClient : strLaunchSGNClient = "msiexec /i " & SGNClientMSILocationFile & " POACFG=" & SGNPOAXMLLocatoinFile & " /passive /L*v " & Chr(34) & LogFileLocation & "\" & WshNetwork.ComputerName & "_SGNClient.log" & Chr(34) & " NOVESA=1 ADDLOCAL=Client,Authentication,BaseEncryption,SectorBasedEncryption,SecureDataExchange,CredentialProvider /norestart" Dim intRetVal : intRetVal = oShell.Run(strLaunchSGNClient,1,True) If intRetVal <> 0 Then ScriptingLog.writeline "Installation of SGN failed, please see installation log file" Msgbox "The installation of SafeGuard Enterprise Client has failed, please contact support for further assistance",0,"Safeguard Enterprise Client Installation" wscript.quit(7) Else ScriptingLog.writeline "Installation of SGN was successful" End If '------------------------------------------------------------------------------' '- Start GINA modification (optional) '------------------------------------------------------------------------------' ' Dim strCopyGINAXMLCMD ' Dim intCopyGINAXML ' ' If OSVer = 5 then ' ' strCopyGINAXMLCMD = "cmd /C " & Chr(34) & "xcopy /y /r " & SGNGINAXMLLocatoinFile & " " & Chr(34) & "C:\Documents and Settings\All Users\Application Data\Utimaco\SafeGuard Enterprise\Import" & Chr(34) & Chr(34) ' intCopyGINAXML = oShell.Run(strCopyGINAXMLCMD,1,True) ' ' Else ' ' End If ' '------------------------------------------------------------------------------' '- Complete installation of configuration MSI '------------------------------------------------------------------------------' Dim strLaunchSGNConfig : strLaunchSGNConfig = "msiexec /i " & SGNConfigMSILocationFile & " /passive /L*v " & Chr(34) & LogFileLocation & "\" & WshNetwork.ComputerName & "_SGNclientConfig.log" & Chr(34) & " /norestart" Dim intRetValSGNConfig : intRetValSGNConfig = oShell.Run(strLaunchSGNConfig,1,True) '------------------------------------------------------------------------------' '- Complete installation of SGN 5.40 Patches '------------------------------------------------------------------------------' '------------------------------------------------------------------------------' '- SGN Client Patch MSP '------------------------------------------------------------------------------' ' Dim strLaunchSGNPatch : strLaunchSGNPatch = "msiexec /update " & SGNPatchMSPLocationFile & " /passive /L*v " & Chr(34) & fso.GetParentFolderName(WScript.ScriptFullName) & "\" & WshNetwork.ComputerName & "_SGNclientPatch.log" & Chr(34) & " /norestart" ' Dim intRetValSGNPatch : intRetValSGNPatch = oShell.Run(strLaunchSGNPatch,1,True) '------------------------------------------------------------------------------' '- SGN Client Patch sggina.dll - DE on XP '------------------------------------------------------------------------------' ' Dim strLaunchSGNGinaCMD : strLaunchSGNGinaCMD = "cmd /C " & Chr(34) & "xcopy /y /r " & SGNPatchSGGINALocationFile & " " & Chr(34) & "c:\Windows\system32" & Chr(34) & Chr(34) ' Dim intRetValSGNGINAPatch : intRetValSGNGINAPatch = oShell.Run(strLaunchSGNGinaCMD,1,True) '------------------------------------------------------------------------------' '- SGN Client Patch sdxrmdlgs.dll - DX ONLY on XP '------------------------------------------------------------------------------' ' Dim strLaunchSGNsdxrmdlgsCMD : strLaunchSGNsdxrmdlgsCMD = "cmd /C " & Chr(34) & "xcopy /y /r " & SGNPatchsdxrmdlgsLocationFile & " " & Chr(34) & "c:\Windows\system32" & Chr(34) & Chr(34) ' Dim intRetValSGNsdxrmdlgsPatch : intRetValSGNsdxrmdlgsPatch = oShell.Run(strLaunchSGNsdxrmdlgsCMD,1,True) '------------------------------------------------------------------------------' '- SGN Client Patch feshellx.dll - DX ONLY on XP '------------------------------------------------------------------------------' ' Dim strLaunchSGNfeshellxCMD : strLaunchSGNfeshellxCMD = "cmd /C " & Chr(34) & "xcopy /y /r " & SGNPatchfeshellxLocationFile & " " & Chr(34) & "C:\Program Files\Utimaco\SafeGuard Enterprise\FileEncryption" & Chr(34) & Chr(34) ' Dim intRetValSGNfeshellxPatch : intRetValSGNfeshellxPatch = oShell.Run(strLaunchSGNfeshellxCMD,1,True) '------------------------------------------------------------------------------' '- Complete GINA modification (Only is RSA is present) '------------------------------------------------------------------------------' ' ' wscript.sleep 30000 ' ' '------------------------------------------------------------------------------' ' '- Supress Windows Vista Credential Provider ' '------------------------------------------------------------------------------' ' Dim osVersion, colVersion, keyString, keyPath, keyName, funcResult ' Set colVersion = objWMIService.ExecQuery ("select * from Win32_OperatingSystem where Primary=true") ' ' For Each osVersion in colVersion ' If StrComp(osVersion.version,"6") > 0 Then ' keyPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers" ' keyString = "{5CDFA681-61C8-423d-999E-32EA10C5F7ED}" ' keyName = keyPath & "\-" & keyString & "\" ' funcResult = oShell.RegWrite(keyName,"UtimacoCredentialProvider","REG_SZ") ' keyName = keyPath & "\" & keyString & "\" ' funcResult = oShell.RegDelete(keyName) ' Else ' ' '------------------------------------------------------------------------------' ' '- ReOrder XP GINA modules ' '------------------------------------------------------------------------------' ' Dim strWindowsGINAPath : strWindowsGINAPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" ' Dim strSGNGINAPath : strSGNGINAPath = "SOFTWARE\Utimaco\SafeGuard Enterprise\Authentication" ' ' Dim strWindowsGINAName : strWindowsGINAName = "GinaDLL" ' Dim strRSAGINAName : strRSAGINAName = "SDSupercededGina" ' Dim strSGNGinaName : strSGNGinaName = "OriginalGina" ' ' Dim strWindowsGINAValue : strWindowsGINAValue = "MSGina.dll" ' Dim strRSAGINAValue : strRSAGINAValue = "c:\program files\rsa security\rsa authentication agent\acegina.dll" ' Dim strSGNGinaValue : strSGNGinaValue = "sggina.dll" ' ' Dim SafeGuardAuthenticationPath : SafeGuardAuthenticationPath = "SOFTWARE\Utimaco\SafeGuard Enterprise\Authentication" ' Dim SafeGuardKnownGinaName : SafeGuardKnownGinaName = "KnownGina" ' Dim SafeGuardKnownGinaValue : SafeGuardKnownGinaValue = "1" ' ' oReg.SetStringValue HKEY_LOCAL_MACHINE,strWindowsGINAPath,strWindowsGINAName,strRSAGINAValue ' oReg.SetStringValue HKEY_LOCAL_MACHINE,strWindowsGINAPath,strRSAGINAName,strSGNGinaValue ' oReg.SetStringValue HKEY_LOCAL_MACHINE,strSGNGINAPath,strSGNGinaName,strWindowsGINAValue ' oReg.SetDWordValue HKEY_LOCAL_MACHINE,SafeGuardAuthenticationPath,SafeGuardKnownGinaName,SafeGuardKnownGinaValue ' ' End If ' Next '------------------------------------------------------------------------------' '-- Schedule CHKDSK /F '------------------------------------------------------------------------------' Dim strLaunchCHKNTFS : strLaunchCHKNTFS = "chkntfs /t:00" Dim intRetValCHKNTFS : intRetValCHKNTFS = oShell.Run(strLaunchCHKNTFS,1,True) Dim strLaunchCHKDSK : strLaunchCHKDSK = "CMD.EXE /C echo Y|Chkdsk.exe C: /F" Dim intRetValCHKDSK : intRetValCHKDSK = oShell.Run(strLaunchCHKDSK,1,True) '------------------------------------------------------------------------------' '-- Reboot computer '------------------------------------------------------------------------------' ' Dim obj : For Each obj in oWMI.ExecQuery("Select * from Win32_OperatingSystem") ' Dim oOS : Set oOS = obj ' Exit For ' Next ' oOS.Win32shutdown(2 + 4) ' Msgbox "Installation of Safeguard Enterprise Client was successful, please reboot your computer immediately",0,"Safeguard Enterprise Client Installation Completed"