I also created the batch file like that but I hated to edit the batch file every time it is copied to a different environment. this is why I created this command with VBScript.
By using VBScript, I can access registry value thus Notes program/data directory information can be retrieved from the registry.
You can run this VBS file just by copying it to any directory on your computer and double-click the file. so I think this sample is useful when you want to access Notes program/data directory automatically in the batch file.
RunNSD.vbs Function GetProgramDir() GetProgramDir = "" Dim objWshShell Set objWshShell = WScript.CreateObject("WScript.Shell") strValue = objWshShell.RegRead("HKLM\SOFTWARE\Lotus\Notes\Path") if Right(strValue,1) <> "\" Then strValue = strValue & "\" End if GetProgramDir = strValue End Function Function GetDataDir() GetDataDir = "" Dim objWshShell Set objWshShell = WScript.CreateObject("WScript.Shell") strValue = objWshShell.RegRead("HKLM\SOFTWARE\Lotus\Notes\DataPath") if Right(strValue,1) <> "\" Then strValue = strValue & "\" End if GetDataDir = strValue End Function Function IsWin2k() IsWin2k = False strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems If Instr (objOperatingSystem.Caption, "Windows 2000") > 0 Then IsWin2k = True End If Next End Function Dim objWshShell Dim strCmdLine Set objWshShell = WScript.CreateObject("WScript.Shell") NSDPath = GetProgramDir() & "nsd.exe" objWshShell.CurrentDirectory = GetDataDir() If Not isWin2k() Then strOption = " -detach" End If strCmdLine = NSDPath & strOption objWshShell.Exec(strCmdLine) If Err.Number <> 0 Then WScript.Echo "NSD Error " & Err.Description End If
NOTE:
- This VBS file checks registry file regarding Notes client.
If you want to run this file on the environment as follows, you need to change registry path.
1) Multi user installation
2) Old version (prior to Lotus Notes 6.5.x)
3) Lotus Domino Server
- "-detach" option is not actually needed on the latest version like 8.5.x or 8.0.x
I added this option so that I just wanted to show OS check logic can be added
- If you want to clean up client after NSD execution, please change strOption as follows.
strOption = " -DumpAndKill"
No comments:
Post a Comment