| Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free! |
Check 4 logoff with vbscript
|
Original Message
|
Name: dazra
Date: April 20, 2006 at 11:02:57 Pacific
Subject: Check 4 logoff with vbscriptOS: XP ProCPU/Ram: IntelModel/Manufacturer: HP |
Comment: I'm trying to make a vbscript which runs in the background constantly, waiting for the user to logoff/shutdown. Once the user clicks on logoff/shutdown, the script stalls that process, and activates a batch file. Once the batch file is done, it resumes logoff/shutdown. I found this script to force a shutdown but can't figure out how to monitor for shutdown rather than shutdown. Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery_ ("select * from Win32_OperatingSystem where Primary=true") for each OpSys in OpSysSet OpSys.Shutdown() next Any thoughts?
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Michael J (by mjdamato)
Date: April 20, 2006 at 11:34:52 Pacific
|
Reply: (edit)That could create a big performance hit. Why not just create a group policy to run the batch file at log off? Thats what it's there for. http://techsupt.winbatch.com/ts/T000001048F90.html Michael J
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: dazra
Date: April 20, 2006 at 12:14:10 Pacific
|
Reply: (edit)Tried it... didn't work. Here's my problem. I have local users and remote users. Local users have a group policy added to run that batch file at log off which works fine. I've tried the same thing with remote users and it doesn't work. Remote users are connecting through a VPN and thats the only way the batch file will work is if they are connected through a vpn to our network. I believe once the user clicks logoff/shutdown it ends the vpn program. Thats why my thoughts where to have a script constantly monitoring for the user to click on logoff/shutdown so that way it doesn't end the vpn and it runs the batch file. If you say it will hog the system and bring it to its knees, then I need to think of something else and please feel free to throw in any ideas.
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: Michael J (by mjdamato)
Date: April 20, 2006 at 13:31:54 Pacific
|
Reply: (edit)I don't know if it will bring it to it's knees, but considering that it would have to check for the initiation of the logoff routine on a milisecond basis it couldn't help performance. I don't even know if it would be possible come to think of it. By the time the user initiates the logoff, the logoff routine would already have started. Could you halt it at that point? not sure. Anyway, are you sure the users connecting through VPN are actually "logging off" and not just terminating the VPN session? nothing you can do aboout that. My suggestion would be to create a custom shutdown script which runs your batch script then logs the computer off. Then put a shortcut on the desktop and instruct all the users to use that instead of whatever method they are using now to log off. It's not a great solution (I hate leaving anything up to the user), but it's the only thing that comes to mind at the moment. Michael J
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: dazra
Date: April 21, 2006 at 06:18:46 Pacific
|
Reply: (edit)Through testing, I've found that once you click logoff or shutdown the VPN connection breaks. I found a solution to my problem though. Its so basic I'm smacking myself in the forehead. I added the batch file as part of the login scripts that run once you log in. The proble I had before was I was pointing to the location of the batch file on our server and when you logged in, it didn't fully have a connection to the server, therefore it didn't run. I added the batch file locally and pointed it to run through there when logging on. It works, but transferes very slowly. Thanks for your info again Michael J. You've been a great help as always. As long as the script runs and works, the user can just minimize and go about their business.
Report Offensive Follow Up For Removal
|

Post Locked
This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
Go to Programming Forum Home