Re: VB Script Error

Tech-Archive recommends: Fix windows errors by optimizing your registry



Is there a way I can have the script run as a domain admin? Such as the
runas command/parameter?



"Richard Mueller" wrote:

No, logon scripts run with the permissions of the user in the domain (and
System privileges on the local computer).

You can run the script after you have logged in. If it works when you are
logged in as Domain Admin, but not as a regular user, then the problem is
permissions. You may need to grant Domain Users permissions.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

"Curtis Rich" <CurtisRich@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1D0B735F-AF96-4993-8EDF-F998A392FB64@xxxxxxxxxxxxxxxx
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



.



Relevant Pages

  • Re: VB Script Error
    ... You can run the script after you have logged in. ... Dim objNetwork ... Set objFileSys = CreateObject ... On Error Resume Next '// disable error reporting (e.g., ...
    (microsoft.public.scripting.vbscript)
  • VB Script Error
    ... When I run this through group policy as a user script, I get an error at line ... Dim objNetwork ... Set objFileSys = CreateObject ... For Each strFileName in strFileArray ...
    (microsoft.public.scripting.vbscript)
  • Re: VB Script Error
    ... You can run the script after you have logged in. ... Dim objNetwork ... Set objFileSys = CreateObject ... On Error Resume Next '// disable error reporting (e.g., ...
    (microsoft.public.scripting.vbscript)
  • RE: export user accounts from NT 4.0 domain
    ... ATTENTION THE SCRIPT MUST BE RUNNED FROM A COMPUTER WHERE EXCEL IS ... from the information in a Microsoft Excel spreadsheet. ... Dim strLast, strFirst, strMiddle, strPW, intRow, intCol ... On Error GoTo 0 ...
    (microsoft.public.windows.server.scripting)
  • Re: Password Expire
    ... We have one fron end Edge server in our DMZ which passes email onto two ... I used to schedule a script to run every 24 hours on my Exchange 2003 ... Dim fso, txtarray, BodyText ... Call ProcessFolder (objContainer, numDays) ...
    (microsoft.public.exchange.admin)