|
-
Mar 5th, 2006, 06:31 PM
#1
Thread Starter
New Member
Permission denied when attempting to post data to log file
Hi Everyone,
At the moment I am seeing a VB logon script error whenever I log into a Windows 2000 server network that I am connected to. Each time my machine logs on it attempts to write information to a log file on the server. However I am seeing an error that looks like the one below:
Error: Permission Denied
Code: 800A0046
Source: Microsoft VBScript runtime error
This is obviously a permissions challenge, however after assigning "modify" permissions to the log file and it's corresponding parent folder there has been no improvement, and the script still produces an error at logon. The script looks like the following:
Option Explicit
Dim fso, a, logFile, WSHNetwork
'change following log path and file name as needed
logFile = "\\...\Logs\Userlogons.log"
set fso = CreateObject("Scripting.FileSystemObject")
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Const OPEN_FILE_FOR_APPENDING = 8
'Following 3 lines just used for testing
'msgbox WSHNetwork.UserName
'msgbox WSHNetwork.ComputerName
'msgbox now()
Set a = fso.OpenTextFile(logFile, OPEN_FILE_FOR_APPENDING)
'write data
a.WriteLine ("LOGON" & "," & now() & "," & WSHNetwork.UserName & "," & WSHNetwork.ComputerName)
'close file
a.Close
Set fso = Nothing
WScript.Quit
The above code fails at line 15, char 1:
Set a = fso.OpenTextFile(logFile, OPEN_FILE_FOR_APPENDING)...
I have determined that this error is occuring because of the "FileSystemObject". However after changing permissions as mentioned above I have seen no improvement. If anybody has any suggestions regarding how to resolve this challenge they will be greatly appreciated.
Kind Regards
David
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|