When I run this through group policy as a user script, I get an error at line
80 Char 3..... Permission Denied. Can anyone explain what may be
happening.... the script is trying to write a license file and .dll to a
Lotus Notes directory, but shouldn't any logon script be performed through
Domain Administrator privileges?
Here is a copy of the script.......
Option Explicit
Const EVENT_TYPE_SXS = 0
Const EVENT_TYPE_ERR = 1
Const EVENT_TYPE_WRN = 2
Const EVENT_TYPE_INF = 4
Const REG_KEY = "HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\Path"
Const REMOTE_PATH = "\\mydomain.com\share"
Const TARGET_DRV = "G:"
Const TARGET_DIR = "\Midas LSX\"
Dim objShell
Dim objNetwork
Dim objFileSys
Dim objFileInstalled
Dim objFileTarget
Dim strNotesPath
Dim strFileArray
Dim strFileName
'// CREATED:
'// 04/12/2006
'//
'// AUTHOR:
'// Developer
'//
'// DESCRIPTION:
'// This script is intended to be used as a login script. It checks for the
presence
'// of a license file and the dll file comprising the Midas LSX (LotusScript
Extension)
'// for use in Lotus Notes client and server applications.
'// Create required WSH objects
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set objFileSys = CreateObject("Scripting.FileSystemObject")
Call objShell.LogEvent(EVENT_TYPE_INF, "Attempting to verify Midas LSX
installation.")
'// Read the registry value for the Notes program directory
On Error Resume Next '// disable error reporting (e.g., if registry key
doesn't exist)
strNotesPath = objShell.RegRead(REG_KEY)
'// If Notes isn't installed, quit the script
If Len(strNotesPath) = 0 Then
MsgBox "Unable to read the following registry key:" & vbCr & vbTab &
REG_KEY & vbCr & "If this condition persists, please notify Networking
Support.", , "Unable to read registry key . . ."
Call objShell.LogEvent(EVENT_TYPE_ERR, "Login script - unable to read the
following registry key: " & vbCr & REG_KEY)
Call WScript.Quit()
End If
'// Attempt to map network drive
On Error Resume Next '// disable error reporting (e.g., if drive is in use)
Call objNetwork.MapNetworkDrive(TARGET_DRV, REMOTE_PATH)
'// Re-enable error reporting
On Error GoTo 0
'// Create an array of the target file names
strFileArray = Array("licmidas.lic", "nlsxrtc.dll")
'// Initialize file objects to nothing
Set objFileInstalled = Nothing
Set objFileTarget = Nothing
'// Check the dates on the required files
For Each strFileName in strFileArray
Set objFileTarget = objFileSys.GetFile(TARGET_DRV & TARGET_DIR & strFileName)
On Error Resume Next '// disable error reporting (e.g., if file isn't found)
Set objFileInstalled = objFileSys.GetFile(strNotesPath & strFileName)
On Error GoTo 0 '// Re-enable error reporting
'// If a version of the file exists, compare dates to determine if an
update is needed
If Not(objFileInstalled Is Nothing) Then
If objFileTarget.DateLastModified > objFileInstalled.DateLastModified Then
'MsgBox "Target file " & objFileTarget.Path & " date modified: " &
objFileTarget.DateLastModified & vbCr & _
'"Installed file " & objFileInstalled.Path & " date modified: " &
objFileInstalled.DateLastModified, , "DEBUG . . ."
Call objFileTarget.Copy(objFileInstalled.Path, True)
Call objShell.LogEvent(EVENT_TYPE_INF, "File " & strFileName & " updated
successfully . . .")
End If
Else '// If a version of the file doesn't exist, copy it to the destination
directory.
Call objFileTarget.Copy(strNotesPath & strFileName, True)
Call objShell.LogEvent(EVENT_TYPE_INF, "File " & strFileName & " added
successfully . . .")
End If
Set objFileInstalled = Nothing
Set objFileTarget = Nothing
Next
'// Dereference WSH objects
Set objShell = Nothing
Set objNetwork = Nothing
Set objFileSys = Nothing
'// Quit the script
Call WScript.Quit()
This script was developed by a programmer and he is certain his script is
perfect. Any help would be greatly appreciated. Thanks