×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

800A004C path not found

800A004C path not found

800A004C path not found

(OP)
I am looking at deploying limitlogon. But I have run into a problem.

Just incase LimitLogon is a microsoft product that restricts client logons, so for instance I can set it to one logon only and the client will be automaticaly logged off the 2nd machine logon.

Ok Here is the problem, on PC1 the first logon I get this error

line 70 Char 4 Path not found  800A004C

CODE

Set filetxt = objFSO.OpenTextFile(strpathname & "logs\" & formatdatetime(Now(),vblongdate) & ".log", 8, True)

and on PC2 logging on with the same user account, it recognises that the user account is already logged in and on which machine, I am then asked to click ok to be logged off, but then I get this error

Line 91 Char 6 Path not found  800A004C

CODE

Set filetxt = objFSO.OpenTextFile(strpathname & "logs\" & formatdatetime(Now(),vblongdate) & ".log", 8, True)

and the machine remains logged on.

The script is deployed by use of group policies and I am able to browse to the location of the script.  I am at the limit (no pun intended) of my vbs knowledgeand would really apprieciate some help.

*************Here is the full logon script***************

CODE

'Begin Constant Declaration
Const Server_Name = "server" 'The server the shared directory will sit on
Const Share_Name = "limitlogon$"     ' The share name

Const ForReading = 1
Const ForAppending = 8
Const TIMEOUT = 60

' Begin Variable declaration

Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set ObjFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")

Dim StrUserName ' Current user
Dim StrStrMachineName
Dim StrStrPathName
Dim StrStrMachineFile
Dim StrStrUserFile
Dim strResponse
Dim textstream
Dim strMachine
Dim strUser
Dim filetxt

'************************* Main Code *************************
'On Error Resume Next

StrUserName = ""
strResponse = ""
' Wait until the user is really logged in...
While StrUserName = ""
   WScript.Sleep 100 ' 1/10 th of a second
   StrUserName = WSHNetwork.UserName ' Get the user name
Wend
StrMachineName = WshNetwork.ComputerName 'Get the machine Name

StrPathName = "\\" & Server_Name & "\" & Share_Name & "\"

If ((StrUserName = "CyberCafe") OR (StrUserName = "ils")) Then
    'Write to log file, do not check for multiple logins.
    Set filetxt = objFSO.OpenTextFile(strpathname & "logs\" & formatdatetime(Now(),vblongdate) & ".log", 8, True)
    filetxt.writeline(Now() & ", " & StrUserName & ", " & StrMachineName)
    filetxt.close
Else
    If ObjFSO.FileExists (StrPathName & StrUserName & ".txt") Then 'If the file exists then the user is already logged in.
        Set StrUserFile = ObjFSO.CreateTextFile(StrPathName & StrUserName & "1.txt")
        StrUserFile.WriteLine StrMachineName
        StrUserFile.WriteLine StrUserName & " " & "has logged onto" & " " & StrMachineName & " at " & NOW()
        StrUserFile.Close
        
        'Read the machine name from username file
        Set StrUserFile = ObjFSO.GetFile(StrPathName & StrUserName & ".txt")
        set textstream = StrUserFile.openastextstream(1,-2)
        strMachine = textstream.readline

        if strMachineName = strmachine then 'The user logged on to this computer, but didn't log out properly
            Set StrUserFile = ObjFSO.CreateTextFile(StrPathName & StrUserName & ".txt")
            StrUserFile.WriteLine StrMachineName
            StrUserFile.WriteLine StrUserName & " " & "has logged onto" & " " & StrMachineName & " at " & NOW()
            StrUserFile.Close
            Set StrMachineFile = ObjFSO.CreateTextFile(StrPathName & StrMachineName & ".txt")
            strMachineFile.WriteLine strUserName
            StrMachineFile.WriteLine StrUserName & " " & "has logged onto" & " " & StrMachineName & " at " & NOW()
            StrMachineFile.Close

            'Write to the log file
            Set filetxt = objFSO.OpenTextFile(strpathname & "logs\" & formatdatetime(Now(),vblongdate) & ".log", 8, True)
            filetxt.writeline(Now() & ", " & StrUserName & ", " & StrMachineName & ", User didn't log out of this machine properly earlier")
            filetxt.close

            ObjFSO.DeleteFile (StrPathName & StrUserName & "1.txt")
        Else 'The user is logged on at another computer

            'Read the username from the machine file
            If ObjFSO.FileExists (StrPathName & StrMachine & ".txt") Then
                Set StrUserFile = ObjFSO.GetFile(StrPathName & StrMachine & ".txt")
                set textstream = StrUserFile.openastextstream(1,-2)
                strUser = textstream.readline
            Else
                strUser = ""
            End If
            If StrUserName = strUser Then 'The user logged on to the other computer is the same as the user trying to logon to this computer
                'Open messagebox informing user that they are already logged on
                intReturn = objShell.Popup("You are already logged in at computer " & strMachine & "!  You will now be logged off this computer.", 30, "Duplicate Login", Ok_Button)

                If intReturn = 1 Then
                        Wscript.Echo "You clicked the ok button. You will now be logged off"
                    Set filetxt = objFSO.OpenTextFile(strpathname & "logs\" & formatdatetime(Now(),vblongdate) & ".log", 8, True)
                    filetxt.writeline(Now() & ", " & StrUserName & ", " & StrMachineName & ", User logged in elsewhere, decided not to login here")
                    filetxt.close
                    WshShell.Run "\\server\limitlogon$\logoff.exe /n"
                Else
                        Wscript.Echo "Logon timed out. You will now be logged off"
                    Set filetxt = objFSO.OpenTextFile(strpathname & "logs\" & formatdatetime(Now(),vblongdate) & ".log", 8, True)
                    filetxt.writeline(Now() & ", " & StrUserName & ", " & StrMachineName & ", User logged in elsewhere, decided not to login here")
                    filetxt.close
                    WshShell.Run "\\server\limitlogon$\logoff.exe /n"
                End If
                
            Else
                'Another User has logged onto the other computer
                Set StrUserFile = ObjFSO.CreateTextFile(StrPathName & StrUserName & ".txt")
                StrUserFile.WriteLine StrMachineName
                StrUserFile.WriteLine StrUserName & " " & "has logged onto" & " " & StrMachineName & " at " & NOW()
                StrUserFile.Close
                Set StrMachineFile = ObjFSO.CreateTextFile(StrPathName & StrMachineName & ".txt")
                strMachineFile.WriteLine strUserName
                StrMachineFile.WriteLine StrUserName & " " & "has logged onto" & " " & StrMachineName & " at " & NOW()
                StrMachineFile.Close
                'Write to the log file
                Set filetxt = objFSO.OpenTextFile(strpathname & "logs\" & formatdatetime(Now(),vblongdate) & ".log", 8, True)
                filetxt.writeline(Now() & ", " & StrUserName & ", " & StrMachineName & ", User didn't log out of other machine correctly")
                filetxt.close
                ObjFSO.DeleteFile (StrPathName & StrUserName & "1.txt")
            End If
        End if
    Else 'The user is not already logged in, so allow them to login without any questions.
        Set StrUserFile = ObjFSO.CreateTextFile(StrPathName & StrUserName & ".txt")
        StrUserFile.WriteLine StrMachineName
        StrUserFile.WriteLine StrUserName & " " & "has logged onto" & " " & StrMachineName & " at " & NOW()
        StrUserFile.Close
        Set StrMachineFile = ObjFSO.CreateTextFile(StrPathName & StrMachineName & ".txt")
        strMachineFile.WriteLine strUserName
        StrMachineFile.WriteLine StrUserName & " " & "has logged onto" & " " & StrMachineName & " at " & NOW()
        StrMachineFile.Close
        'Write to the log file
        Set filetxt = objFSO.OpenTextFile(strpathname & "logs\" & formatdatetime(Now(),vblongdate) & ".log", 8, True)
        filetxt.writeline(Now() & ", " & StrUserName & ", " & StrMachineName & ", User logged in OK")
        filetxt.close

    End If
End If

RE: 800A004C path not found

CaSE matters here. Try this.

At line 35: StrUserName = lcase(WSHNetwork.UserName)
at line 41: If ((StrUserName = "cybercafe") OR (StrUserName = "ils")) Then

I troubleshoot issues like this by echoing out what is going into the IF then echo what has actually made it into the IF.
Example

CODE


wscript.echo that
If this=that then
  wscript.echo "made it into if"
Else
  wscript.echo "made it into else"
End if
I hope this helps.

RE: 800A004C path not found

If the pathname is wrong try sending it to a msgbox and double check that the filename that you are setting is correct msgbox strpathname & "logs\" & formatdatetime(Now(),vblongdate) & ".log"
Sometimes I find that there is a slash I left out.

RE: 800A004C path not found

(OP)
Thanks for the replies I have tried the CaSe issue with no luck, as to the code you suggested where should i put that?

RE: 800A004C path not found

What lines are you getting errors on?

Does the Const Share_Name = "limitlogon$" have permissions for these users to write to the directory?

Would you try to change the limitlogon$ share to a non-hidden share with access for Everyone to Modify the files to see if that works?






RE: 800A004C path not found

(OP)
Hi thanks for the suggestions

I have now made the share a non hidden share and checked and rechecked the permissions the error has now changed to line 121  Char 3 error 800A004C path not found

Set StrUserFile = ObjFSO.CreateTextFile(StrPathName & StrUserName & ".txt")


RE: 800A004C path not found

Did you try echoing out: StrPathName & StrUserName & ".txt" to see if it is the correct path?

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close