注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

mylotustips的博客

IBM Lotus协作产品家族经验分享

 
 
 

日志

 
 
关于我

欢迎大家使用SR向IBM800提交问题http://www.ibm.com/support/servicerequest 可以随时查看问题状态,上传文件

网易考拉推荐

Notes 8.5.3+FP4IF2的安装脚本  

2013-07-08 11:50:37|  分类: Notes客户机 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
853FP4 Interim Fix2里面包含针对最近公布的一些 Notes 安全漏洞的补丁,建议立即安装。
管理员可以通过以下InstallNotes85.vbs脚本实现顺序静默安装Notes 8.5.3+FP4IF2,节省用户时间:
  • 安装成功后会显示:“IBM Lotus Notes 8.5.3 FP4 SHF69 Setup completed successfully.”
  • 安装失败后会显示:“The Notes 8.5.3 FP4 installation failed. Please contact the Help Desk.
安装日志名为Notes_ChainedInstall.txt,
如果详细的安装日志,请运行  InstallNotes85.vbs -v
安装日志名为Notes853Install.txt和NotesFP4Install.txt,位于%tmp%\IBM_Logs_MMDD
(如C:\Documents and Settings\admin\Local Settings\Temp\IBM_Logs_078)
'-----------------------------------------------------------------
' IBM Lotus Notes Chained Install Example script
' URL: http://www-10.lotus.com/ldd/installblog.nsf/dx/chained-installs
' Copyright IBM Corp. 2010
'
' This program is distributed in the hope that it will be useful, but
' WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
'
' Written by J. Mitchell, S. Williams
'-----------------------------------------------------------------
'
' This script is intended to be an example of how to chain two Lotus Notes
' installations together for use with SmartUpgrade. It assumes the installation
' kits are on a network share. It also takes 1 optional parameter when invoked.
'    -v which turns on verbose logging in the Notes installer

Const strScriptVersion = "1.001" ' bump this with every release

' the following constants are the locations of the Notes install kits and should
' be changed for your environment
Const str853Path =   "\\server\share\Notes853\setup.exe" 
Const strFP4Path =   "\\server\share\Notes853FP4\853FP4SHF69_W32_standard.exe"

' Notes processes we kill
arrPrograms = array("'notes2.exe'", "'notes2w.exe'", "'notes.exe'", "'nlnotes.exe'", "'ntmulti.exe'", "'ntaskldr.exe'")

' Eclipse process we kill more descriminately
strEclipse = "'eclipse.exe'"
strFingerprint = "ibm.notes.branding.notes"

' values used for process watching 
Const timeout  = 999900000 'in millisecond
Const timepoll = 500     'in millisecond

' values use in regsitry cleaning
Const HKCU = &H80000001 
Const HKLM = &H80000002

'SetupX, FixPakX, and are the exec object for the upgrade setup, the fixpack setup,
Dim SetupX, FixPackX
Dim strProgPath 'stores the registry to point to the Lotus Notes installation path.

Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")
Dim SVC      : Set SVC = GetObject("winmgmts:root\cimv2")
Dim FSO      : Set FSO = CreateObject("Scripting.FileSystemObject")
Dim REG     : Set REG = GetObject("winmgmts:\\.\root\default:StdRegProv") 

'Collect all the logs and information to the %TEMP%\IBM_Logs_<DATE> directory for easy finding later
If Month(Now) < 10 Then
   months = "0" & Month(Now) ' make it look nice with a leading 0
End If
LogDir = WshShell.ExpandEnvironmentStrings("%temp%") & "\IBM_Logs_" & months & "" & Day(Now) & "\"

If Not FSO.FolderExists(LogDir) Then 
   FSO.CreateFolder(LogDir)
End If

'Setup log file to track progress and time the upgrade.
Set LogStream = FSO.CreateTextFile(LogDir &"Notes_ChainedInstall.txt" , True)

' Write a header to the log
LogStream.WriteLine(Now & ": Starting Lotus Notes Chained installation script (Version " & strScriptVersion & ")")
LogStream.WriteLine(Now & ": WSH Version " & wscript.Version)

' make sure we have valid pre-populated area to run installation kits from
If Not FSO.FileExists(str853Path) Then
   LogStream.WriteLine(Now & ": The Notes 8.5.3 install kit was not found at " & str853Path)
   wScript.Echo("The Lotus Notes 8.5.3 installer files are missing. Please contact the Help Desk")
   wScript.Quit(255)
End If

If Not FSO.FileExists(strFP4Path) Then
   LogStream.WriteLine(Now & ": The Notes 8.5.3 FP4 install kit was not found at " & str853Path)
   wScript.Echo("The Lotus Notes 8.5.3 FP4 installer files are missing. Please contact the Help Desk")
   wScript.Quit(255)
End If

' check if the current user is an admin by checking if they can see the Admin$ share
' comment this part out if using SURunAs or running with elevated privledges
If Not FSO.FolderExists("\\" & WshShell.ExpandEnvironmentStrings("%computername%") & "\Admin$\System32") Then 
    LogStream.WriteLine(Now & ": The user is not a local admin on this machine: " & WshShell.ExpandEnvironmentStrings("%COMPUTER%"))
    wScript.Echo("You are not an Administrator of this machine.  Please contact the Help Desk.")
    wScript.Quit(255)
End If

' Look for and terminate any lingering Notes/Eclipse processes
For Each Program In arrPrograms
   Set colProcessList = SVC.ExecQuery ("Select * from Win32_Process Where Name = " & Program)
   For Each objProcess in colProcessList
      objProcess.Terminate()
   LogStream.WriteLine(Now & ": Terminated " & objProcess.Name) 
   Next
Next
' Find the process
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}").ExecQuery ("SELECT * FROM Win32_Process Where Name = " & strEclipse)

' Determine if its ours and if so terminate it
For Each objProcess In objWMIService
    If (InStr(objProcess.CommandLine, strFingerprint) > 0) Then
        objProcess.Terminate()
        LogStream.WriteLine(Now & ": Terminated " & objProcess.Name)
    End If
Next

' Look for and close the lingering java debug crash dialog box
if (WshShell.AppActivate("IBM Lotus Notes")) Then
   ' found it so send it the Enter key to make it go away
   wshShell.SendKeys("{ENTER}")
   LogStream.WriteLine(Now & ": Found the java crash dialog box and closed it.")
End if

' Read the Notes installation path from the registry, this will cause a error msg box if the reg key does not exist (aka Notes is not installed)
On Error Resume Next
strProgPath = WshShell.RegRead("HKLM\Software\Lotus\Notes\Path")
LogStream.WriteLine(Now & ": Notes program folder from registry = " & strProgPath)
strMultiUser = wshShell.RegRead("HKLM\Software\Lotus\Notes\MultiUser")
If (Not IsEmpty(strMultiUser)) And (strMultiuser = 1) Then
strDataPath =  wshShell.RegRead("HKCU\Software\Lotus\Notes\8.0\NotesIniPath")
' remove the notes.ini from the end of the value retrieved
strDataPath = "" & Left(strDataPath,Len(strDataPath) - Len("notes.ini"))
Else
strDataPath = wshShell.RegRead("HKLM\Software\Lotus\Notes\DataPath")
End If
LogStream.WriteLine(Now & ": Notes data folder from registry = " & strDataPath)
On Error GoTo 0

If Not IsEmpty(strProgPath) Then
    ' Notes was found in the registry but it's probably not 8.0.2  check to see if it's 8.5.3
    On Error Resume Next
    strNotesVer = WshShell.RegRead("HKLM\Software\Lotus\Notes\Version")
    On Error GoTo 0
    If Not IsEmpty(strNotesVer) Then
LogStream.WriteLine(Now & ": Found Notes version " & strNotesVer)
    Else
        LogStream.WriteLine(Now & ": Found unknown version of Notes in registry running collect and cleanup")
CollectAndCleanUp
    End If
Else
LogStream.WriteLine(Now & ": Notes not found in registry, assuming a clean machine.")
End If
set cproc=nothing

'Notes was not in the registry or we've just cleaned it up. moving right along...

'Check a command line option to determine if the install will include verbose logging.  
'To enable the verbose logging enter -V or -v as the first command line argument when launching this script.
If Wscript.Arguments.Count > 0 then Verbose = WScript.Arguments(0)  'set first command line arg to Verbose - used to enable logging
If LCase(Verbose) = "-v"  then ' If verbose is -v then get verbose logging to the users temp directory
    LogStream.writeline(Now & ": Verbose logging is enabled for Notes 8.5.3 and FP4 installations.")
    LogStream.writeline(Now & ": Verbose logs can be found in the " & LogDir & " directory.")

    strSetupCmd = str853Path & " /s /v" & chr(34)&"/l*v " & LogDir &"notes853install.txt /qb!" & chr(34)
    strFixPackCmd = strFP4Path & " -s -a /s /v" & chr(34)&"/l*v " & LogDir &"notesFP4install.txt /qb+" & chr(34)
Else
    strSetupCmd = str853Path & " /s /v" & chr(34)&"/qb!" & chr(34)
    strFixPackCmd = strFP4Path &" -s -a /s /v" & chr(34)&"/qb+" & chr(34)
End If

'Launch the 8.5.3 setup
LogStream.WriteLine(Now & ": Lauching 8.5.3 installation") 
Set SetupX = WshShell.Exec(strSetupCmd)
LogStream.WriteLine(Now & ":    Running " & strSetupCmd)

' Sleep a bit before starting to monitor the process
wScript.Sleep(5000)

WaitForProcess SetupX,"Notes 8.5.3",true

wScript.Sleep(10000) ' wait 10 seconds to give the notes2.exe process time to quit from the 8.5.3 install

'Launch the 8.5.3 FP4 install
LogStream.WriteLine(Now & ": Launching 8.5.3 FP4 installation")
Set FixPackX = WshShell.Exec(strFixPackCmd)
LogStream.WriteLine(Now & ":    Running " & strFixPackCmd)

WaitForProcess FixPackX,"Notes 8.5.3 FP4",false

LogStream.WriteLine(Now & ": Installation completed ")
LogStream.WriteLine(Now & ": The installation completed with a final exit code of: " & Err)

If Err <> 0  then ' If we end with an error, provide a description.
    LogStream.WriteLine("The install failed with error: " & Err.Description)
End If

LogStream.Close



Function WaitForProcess(Process,strName,bCleanUp)
    sQuery="select * from win32_process where ProcessID=" & Process.ProcessID & ""

    For i=0 to timeout\timepoll   'Monitor the process and wait until the process exits.
        Set cproc=SVC.execquery(sQuery)

        If cproc.count=0 Then    'this monitor all instances died out
            LogStream.WriteLine(Now & ": " & strName & " completed with return code: " & Process.ExitCode)
            If Not (Process.ExitCode) = 0 Then
                ' process did not complete successfully, collect the logs and clean the machine
                If Not (bCleanup = -1) Then
                   CollectAndCleanUp(bCleanUp)
                End If
                ' Notify the user and then quit out of the script
                WScript.Echo("The " & strName & " installation failed.  Please contact the Help Desk.")
                LogStream.Close
                wScript.Quit(SetupX.ExitCode)
            End If
            ' The 851 install finished ok its time to 
            Exit For
    Else
            If i=timeout\timepoll Then
                LogStream.WriteLine(Now & ": " & strName & " installation took longer than " &  timeout\1000*60 & " minutes.")
                wScript.Echo("The "& ": " & strName & " installation is taking longer than expected.  Please contact the Help Desk.")
                LogStream.Close
                wScript.Quit(255)
            Else
                wScript.Sleep(timepoll) 'sleep while we wait for setup to finish
            End if
End if
    Next
    Set cproc=nothing
End Function


Function CollectAndCleanUp(DoCleanup)
    LogStream.WriteLine(Now & ": Entered Collect and Clean Up")

    On Error Resume Next
    ' Refead the Notes installation path from the registry, it might have just been installed
    strProgPath = WshShell.RegRead("HKLM\Software\Lotus\Notes\Path")
    LogStream.WriteLine(Now & ": Notes program folder from registry = " & strProgPath)
    strMultiUser = wshShell.RegRead("HKLM\Software\Lotus\Notes\MultiUser")
    If (Not IsEmpty(strMultiUser)) And (strMultiuser = 1) Then
        strDataPath =  wshShell.RegRead("HKCU\Software\Lotus\Notes\8.0\NotesIniPath")
        ' remove the notes.ini from the end of the value retrieved
        strDataPath = "" & Left(strDataPath,Len(strDataPath) - Len("notes.ini"))
    Else
        strDataPath = wshShell.RegRead("HKLM\Software\Lotus\Notes\DataPath")
    End If
    LogStream.WriteLine(Now & ": Notes data folder from registry = " & strDataPath)
    LogStream.WriteLine(Now & ":    Collecting log files into " & LogDir)
    
    FSO.CreateFolder(LogDir & "workspace\")
    FSO.CopyFolder strDataPath & "workspace\logs",LogDir & "workspace\logs",true

    FSO.CreateFolder(LogDir & "workspace\.config")
    FSO.CopyFile strDataPath & "workspace\.config\*", LogDir & "workspace\.config",true

    FSO.CreateFolder(LogDir & "workspace\.configbak")
    FSO.CopyFile strDataPath & "workspace\.configbak\*", LogDir & "workspace\.configbak",true

    FSO.CreateFolder(LogDir & "workspace\.config\org.eclipse.update")
    FSO.CopyFile strDataPath & "workspace\.config\org.eclipse.update\*", LogDir & "workspace\.config\org.eclipse.update",true

    FSO.CreateFolder(LogDir & "workspace\.configbak\org.eclipse.update")
    FSO.CopyFile strDataPath & "workspace\.configbak\org.eclipse.update\*", LogDir & "workspace\.configbak\org.eclipse.update",true

    FSO.CreateFolder(LogDir & "workspace\.metadata")
    FSO.CreateFolder(LogDir & "workspace\.metadata\.plugins")
    FSO.CopyFolder strDataPath & "workspace\.metadata\.plugins\org.eclipse.core.runtime", LogDir & "workspace\.metadata\.plugins\org.eclipse.core.runtime",true

    FSO.CreateFolder(LogDir & "framework\")
    FSO.CopyFile strProgPath & "framework\*", LogDir & "framework",true

    FSO.CreateFolder(LogDir & "framework\rcp")
    FSO.CopyFile strProgPath & "framework\rcp\*", LogDir & "framework\rcp",true

    FSO.CreateFolder(LogDir & "framework\rcp\deploy")
    FSo.CopyFile strProgPath & "framework\rcp\deploy\*", LogDir & "framework\rcp\deploy",true

    FSO.CreateFolder(LogDir & "framework\rcp\deploy\kitHistory")
    FSo.CopyFile strProgPath & "framework\rcp\deploy\kitHistory\*", LogDir & "framework\rcp\deploy\kitHistory",true 

    FSO.CopyFile WshShell.ExpandEnvironmentStrings("%temp%") & "\rcplauncher.log",LogDir,true
    FSO.CopyFile WshShell.ExpandEnvironmentStrings("%temp%") & "\rcpinstallertemp.properties",LogDir,true

    On Error GoTo 0

    ' grab the directory listing for the workspace and framework directories
    If FSO.FolderExists(strDataPath & "workspace") Then 
        Set workspace_list = FSO.CreateTextFile(LogDir &"workspace_list.txt" , true)
        ListDirectoryContents fso.GetFolder(strDataPath & "workspace"),workspace_list 
        workspace_list.Close
    Else
        LogStream.WriteLine(Now & ": No workspace directory found at " & cstrDataPath)
    End If

    If FSO.FolderExists(strProgPath & "framework") Then 
        Set framework_list = FSO.CreateTextFile(LogDir &"framework_list.txt" , true)
        ListDirectoryContents fso.GetFolder(strProgPath & "framework"),framework_list 
        framework_list.Close
    Else
        LogStream.WriteLine(Now & ": No framework directory found at " & cstrProgPath)
    End If

    ' Collections all done, time to clean up
    LogStream.WriteLine(Now & ":    Collection finished")
        
    If (DoCleanUp) Then
        LogStream.WriteLine(Now & ":    Starting Clean up")

        If FSO.FolderExists(strDataPath) Then
            ' NSD needs to run from the users data directory at this time
            WshShell.CurrentDirectory = strDataPath

            ' Launch NSD
            strNSDCmd = strProgPath & "nsd.exe -dumpandkill -batch"
            Set NSDx = WshShell.Exec(strNSDCmd)
            LogStream.WriteLine(Now & ": Launched " & strNSDCmd)
            
            WaitForProcess NSDx,"NSD -kill",-1

            'grab the latest NSD logs just to be crazy careful
            FSO.CreateFolder(LogDir & "nsd_logs")
            FSO.CopyFile strNotesData & "IBM_TECHNICAL_SUPPORT\*.log", LogDir & "nsd_logs",true
        End If
        On Error Resume Next
        
        LogStream.WriteLine(Now & ": Cleaning up the registry")
        DeleteSubkeys HKLM, "Software\Lotus\Notes"
        DeleteSubKeys HKLM, "Software\IBM\Lotus\Expeditor"
        DeleteSubKeys HKCU, "Software\Lotus\Notes"

        ' remove the folders
        LogStream.WriteLine(Now & ": Cleaning up the framework directory")
        FSO.DeleteFolder strProgPath & "framework",true 
        LogStream.WriteLine(Now & ": Cleaning up the workspace directory")
        FSO.DeleteFolder strDataPath & "workspace", true
        On Error GoTo 0
    End If
    Logstream.WriteLine(Now & ": Exiting Collect and Clean Up")
End Function


'# Recursively search the directory provided
Function ListDirectoryContents(directory,listfile)

  '# If it is a directory search again
  For Each subDirectory In directory.SubFolders
    ListDirectoryContents subDirectory,listfile
  Next

  '# If it is a file check to see that it matches the conditions
  For Each file In directory.Files
listfile.WriteLine(file.path)
  Next
End Function



Function DeleteSubkeys(Hive, strKeyPath) 
    REG.EnumKey Hive, strKeyPath, arrSubkeys 

    If IsArray(arrSubkeys) Then 
        For Each strSubkey In arrSubkeys 
            DeleteSubkeys Hive, strKeyPath & "\" & strSubkey 
        Next 
    End If 

   REG.DeleteKey Hive, strKeyPath 
End Function

  评论这张
 
阅读(1530)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017