Jump to content

Recommended Posts

Posted

I'm still struggling with this problem and VBS is not a strong part for me in fact I know didly squat.

 

SO I have posted the same question on a VBS forum and got some replies

 

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

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.

 

and

 

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.

 

I tried the CaSe but that didn't work as to the other suggestion could someone tell me what that they are asking me to do.

Posted

at the start of the script where you have the constants , have you changed the share name from :

 

Const Share_Name = "limitlogon$"

 

to a sharename that you have on your invincble server ?

 

Also for the other suggestion he gave you the code to try out which was :

 

msgbox strpathname & "logs\" & formatdatetime(Now(),vblongdate) & ".log"

 

and he is basically saying to use that instead of trying to write that to a text file as per here :

 

'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 you have any other chunks of code that uses the same code with regards to creating a text file in this manner then I would suggest you check the paths of them as well using a messagebox so that it prompts you with the full path including the filename , slashes etc, that way you can see for yourself if the path is correct.

Posted

I have spent far too many hours on this now but I thnk I might be getting somewhere.

 

If I have the share name as limilogon$ I get an error on line 130 char 3 path not found on PC1

 

then when I log on to PC2 I get the mesage box informing me that I am already logged on elsewhere and that i will be logged off on clicking the OK button I then get another error on line 91 char 6 path not found.

 

HOWEVER

 

If I rename the share to limitlogon and change the referances in the script to suite I get a different error....

I log onto PC1

and get this error 121 char bad file name or number 800A0034

 

when I log onto PC2 I get the same error but I don't get the message box telling me I'm already logged on

 

Any ideas..... anyone have a working script for limit logon that logs the user off?

  • 2 years later...
  • 4 months later...
Posted

The issue i have with this script is when a user resets their PC (or there is another issue where the PC resets itself) and the log off action does not occur. This would result in a Service Desk job to remove the file or db entry wouldnt it?

 

k

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...