+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 33
Windows Thread, How Can I Make This VB Script Loop?? in Technical; Originally Posted by Steve21 Any idea what it's hanging on? It should only hang if something is open normally. To ...
  1. #16

    Join Date
    Jun 2009
    Posts
    372
    Thank Post
    14
    Thanked 3 Times in 3 Posts
    Rep Power
    20
    Quote Originally Posted by Steve21 View Post
    Any idea what it's hanging on? It should only hang if something is open normally.

    To kill IE this should work: (again, will need to test it :P Don't like killing my stuff )

    Code:
    Set objShell = CreateObject("Wscript.Shell") 
    objShell.Run("taskkill /im iexplore.exe"), 1, TRUE
    On further testing, sometimes it does log the user straight off after you unlock, sometimes it gets stuck in the logoff process but get the trying to end explorer.exe process i described above BUT i dont think they can actually get anything to load when its in this state, although i've not exhaustivly checked this. Because i'm a VB noob, where exactly would i put that line to kill iexplorer.exe? above the shutdown line (i changed it to logoff on mine)?
    Thanks for all your help, i really appreciate it!

  2. #17

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by farquea View Post
    On further testing, sometimes it does log the user straight off after you unlock, sometimes it gets stuck in the logoff process but get the trying to end explorer.exe process i described above BUT i dont think they can actually get anything to load when its in this state, although i've not exhaustivly checked this. Because i'm a VB noob, where exactly would i put that line to kill iexplorer.exe? above the shutdown line (i changed it to logoff on mine)?
    Thanks for all your help, i really appreciate it!
    Quote Originally Posted by farquea View Post
    On further testing, sometimes it does log the user straight off after you unlock, sometimes it gets stuck in the logoff process but get the trying to end explorer.exe process i described above BUT i dont think they can actually get anything to load when its in this state, although i've not exhaustivly checked this. Because i'm a VB noob, where exactly would i put that line to kill iexplorer.exe? above the shutdown line (i changed it to logoff on mine)?
    Thanks for all your help, i really appreciate it!
    Easiest way would be just adding it as such:

    Code:
    Do Until ObjFSO.DriveExists("h:")
        WshShell.Run("taskkill /im iexplore.exe"), 1, TRUE
        WshShell.Run "shutdown /l /f /t 0"
    Loop
    It's the same wshshell var. so can just rename it to get rid of a line.

    And your comment on "change it to a logoff", Mine WAS a logoff shutdown /l (logoff) /f (force) /t 0 (0 seconds)

    Steve

  3. #18

    Join Date
    Jun 2009
    Posts
    372
    Thank Post
    14
    Thanked 3 Times in 3 Posts
    Rep Power
    20
    seems the script still isnt stopping them, it looks like if they pull the network cable at the right time, somehow it doesnt work because kids are still getting on facebook, youtube etc. So starting to run out of ideas, if anyone has anything else we could try it would be greatly appreciated!

  4. #19

    nephilim's Avatar
    Join Date
    Nov 2008
    Location
    Dunstable
    Posts
    11,935
    Thank Post
    1,628
    Thanked 1,898 Times in 1,410 Posts
    Blog Entries
    2
    Rep Power
    429
    perhaps ISA server and reroute all requests of facebook, youtube etc to a page that says to go see you?

    Have the ISA sitting right before the internet goes out

  5. #20

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by farquea View Post
    seems the script still isnt stopping them, it looks like if they pull the network cable at the right time, somehow it doesnt work because kids are still getting on facebook, youtube etc. So starting to run out of ideas, if anyone has anything else we could try it would be greatly appreciated!
    I don't mean to sound really patronising here, but I'm assuming you are running the script locally, not off a network? aka, It's not that it's just not downloading/accessing the script in the first place?

    Totally different option, could take a look at EduLock below :P

    Steve

  6. #21

    Join Date
    Jun 2009
    Posts
    372
    Thank Post
    14
    Thanked 3 Times in 3 Posts
    Rep Power
    20
    problem is staff use youtube and its not just facebook and youtube, its lots of other sites like game sites. My colleague is looking at denying all internet access to unauthenticted users which would solve it, except that then causes problems for some of our servers, such as anti virus updates and the same amount of computers we have on the network that are connected but not on the domain, such as staff ipdas and phones etc.

    As they are locking the workstation to prevent the logoff script from running, i'm thinknig how easy would it be to put something together that either disables all keyboard input for the first 10 seconds or the ability to lock the worksation, and so that it only is enabled after 10 seconds...... although i'm not sure a) if they will still be able to prevent a script like that running or if its even possible to do as i wouldnt have a clue where to start trying to script something like that

  7. #22

    Join Date
    Jun 2009
    Posts
    372
    Thank Post
    14
    Thanked 3 Times in 3 Posts
    Rep Power
    20
    Quote Originally Posted by Steve21 View Post
    I don't mean to sound really patronising here, but I'm assuming you are running the script locally, not off a network? aka, It's not that it's just not downloading/accessing the script in the first place?

    Totally different option, could take a look at EduLock below :P

    Steve
    the script is copied to the windows directory and run on startup.

  8. #23

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by farquea View Post
    the script is copied to the windows directory and run on startup.
    Copied as in, "always there". Or copied as in "on logon".

    Just if they're disconnecting it before you're copying it over, (if doing on logon) it wouldn't work.

    Steve

  9. #24

    Join Date
    Jun 2009
    Posts
    372
    Thank Post
    14
    Thanked 3 Times in 3 Posts
    Rep Power
    20
    Quote Originally Posted by Steve21 View Post
    Copied as in, "always there". Or copied as in "on logon".

    Just if they're disconnecting it before you're copying it over, (if doing on logon) it wouldn't work.

    Steve
    copied so that its always there yes

  10. #25

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by farquea View Post
    copied so that its always there yes
    Strange... You got a test machine laying around to try something on? :P

    Steve

  11. #26

    Join Date
    Jun 2009
    Posts
    372
    Thank Post
    14
    Thanked 3 Times in 3 Posts
    Rep Power
    20
    Quote Originally Posted by Steve21 View Post
    Strange... You got a test machine laying around to try something on? :P

    Steve
    yep sure have

  12. #27

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Try this, It's not pretty just want to test if it's just the way you're running the logoff that's the issue.

    testDrive4.zip

    Obviously needs to run as admin, but then the script would anyway.

    Just want to see if it works for you, or not :P or if there's a bigger issue at hand. (Should test H: drive after 10 seconds think that's what you said? (Not sure if you'll need bigger delay, due to slow loading, but we'll see)

    Steve

  13. #28

    Join Date
    Jun 2009
    Posts
    372
    Thank Post
    14
    Thanked 3 Times in 3 Posts
    Rep Power
    20
    Quote Originally Posted by Steve21 View Post
    Try this, It's not pretty just want to test if it's just the way you're running the logoff that's the issue.

    testDrive4.zip

    Obviously needs to run as admin, but then the script would anyway.

    Just want to see if it works for you, or not :P or if there's a bigger issue at hand. (Should test H: drive after 10 seconds think that's what you said? (Not sure if you'll need bigger delay, due to slow loading, but we'll see)

    Steve
    I just dropped it into the startup folder for all users and logged on as a student, unplugged the cable like they do then locked the worksation and to my joy it still logged them off! - so was this what it should be doing, some sort of check at logon and force a logoff even if the workstation is locked??

    If i log on without unplugging though i get a window "Form1" come up saying timer started, timer proc'd and drive mapped i think it is. Then if i try and unplug a cable after this it doesnt log me off (which is exactly what i want as kids have a habit of turning off the wireless switch on their mates laptops, so i'm happy for our current script to just detect this and lock the workstation and kill iexplorer, to carry on doing this)

    So can you just tell me exactly what this does, in case i've got it a bit wrong or if there is a feature i've not come accross yet and then i guess the question is can we get the form1 window to not be visible at logon??

    Thanks again for all your help with this btw.

  14. #29

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,696
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by farquea View Post
    I just dropped it into the startup folder for all users and logged on as a student, unplugged the cable like they do then locked the worksation and to my joy it still logged them off! - so was this what it should be doing, some sort of check at logon and force a logoff even if the workstation is locked??

    If i log on without unplugging though i get a window "Form1" come up saying timer started, timer proc'd and drive mapped i think it is. Then if i try and unplug a cable after this it doesnt log me off (which is exactly what i want as kids have a habit of turning off the wireless switch on their mates laptops, so i'm happy for our current script to just detect this and lock the workstation and kill iexplorer, to carry on doing this)

    So can you just tell me exactly what this does, in case i've got it a bit wrong or if there is a feature i've not come accross yet and then i guess the question is can we get the form1 window to not be visible at logon??

    Thanks again for all your help with this btw.
    Short answer, It seems the shutdown.exe doesn't like being run through scripted commands. Not sure why, or how.

    Just reworked the logoff to by like my EduLock style. So it does a WMI call to do it instead. WMI works wonders, love it

    Basically its working just as you did it originally:

    Load on startup
    Wait 10 seconds
    Check if H exists
    If yes, do nothing (Ignoring debug output)
    If no, logoff

    Would you prefer me to try to rewrite the original script (VBS style) for WMI, or you happy with an exe if I just remove the forms etc?

    Steve

  15. #30

    Join Date
    Jun 2009
    Posts
    372
    Thank Post
    14
    Thanked 3 Times in 3 Posts
    Rep Power
    20
    Quote Originally Posted by Steve21 View Post
    Short answer, It seems the shutdown.exe doesn't like being run through scripted commands. Not sure why, or how.

    Just reworked the logoff to by like my EduLock style. So it does a WMI call to do it instead. WMI works wonders, love it

    Basically its working just as you did it originally:

    Load on startup
    Wait 10 seconds
    Check if H exists
    If yes, do nothing (Ignoring debug output)
    If no, logoff

    Would you prefer me to try to rewrite the original script (VBS style) for WMI, or you happy with an exe if I just remove the forms etc?

    Steve
    Thats brilliant, could i ask that you rewrite the original script for WMI. That would be brilliant if you could.

SHARE:
+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Replies: 16
    Last Post: 14th September 2010, 06:48 AM
  2. Replies: 4
    Last Post: 28th July 2010, 11:46 AM
  3. How can I make a virtualbox disk image read only?
    By reggiep in forum Thin Client and Virtual Machines
    Replies: 13
    Last Post: 29th April 2009, 06:42 PM
  4. How can I make bootable ghost (image) CDís
    By chrisreed in forum O/S Deployment
    Replies: 4
    Last Post: 9th February 2009, 08:24 PM
  5. How can I add this code?
    By kerlj001 in forum EduGeek Joomla 1.0 Package
    Replies: 0
    Last Post: 10th December 2008, 08:43 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •