+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 38
Scripts Thread, Shutdown Script in Coding and Web Development; Originally Posted by monkeyx The script writes all output to logfile.txt rather than the screen. Is that showing anything? No ...
  1. #16
    jsnetman's Avatar
    Join Date
    Oct 2007
    Posts
    887
    Thank Post
    23
    Thanked 134 Times in 126 Posts
    Rep Power
    39
    Quote Originally Posted by monkeyx View Post
    The script writes all output to logfile.txt rather than the screen.

    Is that showing anything?
    No nothing, it creates the file but it is empty.

  2. #17
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,524
    Thank Post
    106
    Thanked 88 Times in 74 Posts
    Blog Entries
    46
    Rep Power
    40
    what time do you shut them down?

    I have a scheduled script that does ours at 4pm but takes note of anyone logged in, doesnt shut them down and then a later scheduled script takes care of those ones.

  3. #18
    jsnetman's Avatar
    Join Date
    Oct 2007
    Posts
    887
    Thank Post
    23
    Thanked 134 Times in 126 Posts
    Rep Power
    39
    9pm as we have adult classes most nights.

  4. #19
    monkeyx's Avatar
    Join Date
    Nov 2006
    Posts
    364
    Thank Post
    8
    Thanked 52 Times in 41 Posts
    Rep Power
    25
    Quote Originally Posted by jsnetman View Post
    No nothing, it creates the file but it is empty.
    It must be because you are pointing an OU with no sub OUs?

    I will amend the script so that it process the parent and children OUs.
    Someone else has also asked if I can add a section to skip OUs as well computers.

    A few people have mentioned freeware or commercial alternatives.

    The script is totally free and open for anyone to use and change. So has an advantage over freeware, also does not need a client. It forcefully throws people off to prevent them being logged in and leaving equipment on over night, part of an eco drive at our school!

    The warning time can be changed, or individual computers can be left out of the shutdown scheme.

  5. #20
    monkeyx's Avatar
    Join Date
    Nov 2006
    Posts
    364
    Thank Post
    8
    Thanked 52 Times in 41 Posts
    Rep Power
    25
    I have added the following to the script I posted yesterday to process computers in the parent OU, before going on to process child OUs and computers.

    'Process computers in first level of OU.
    objParent.Filter = Array("computer")
    Call ouComp(objParent)

    Hopefully that should work for you now.

    PS a couple of people asked about where this should be run from. We run it from a server as a scheduled task, that runs all our scheduled tasks and monitoring tasks. But it can be run from any PC or server that has admin access to the PCs, that you are wanting to shutdown.
    Last edited by monkeyx; 27th March 2009 at 08:25 AM.

  6. #21
    mullet_man's Avatar
    Join Date
    Oct 2005
    Location
    Oldham
    Posts
    726
    Thank Post
    34
    Thanked 46 Times in 45 Posts
    Rep Power
    26
    Cheers for the script monkeyx

    Will it shutdown machines that are locked? As our current psshutdown seems to struggle with locked machines.

    Cheers.

  7. #22
    jsnetman's Avatar
    Join Date
    Oct 2007
    Posts
    887
    Thank Post
    23
    Thanked 134 Times in 126 Posts
    Rep Power
    39
    I have added the following to the script I posted yesterday to process computers in the parent OU, before going on to process child OUs and computers.
    Thanks for trying but I don't have any PC's in the parent OU my Ou structure is like this:

    OU.JPG

  8. #23
    monkeyx's Avatar
    Join Date
    Nov 2006
    Posts
    364
    Thank Post
    8
    Thanked 52 Times in 41 Posts
    Rep Power
    25
    The parent in relation to the script starting OU, not parent in the domain?

    Did you try the new script?

  9. Thanks to monkeyx from:

    jsnetman (27th March 2009)

  10. #24
    jsnetman's Avatar
    Join Date
    Oct 2007
    Posts
    887
    Thank Post
    23
    Thanked 134 Times in 126 Posts
    Rep Power
    39
    Did you try the new script?
    yeah it's working a treat. Thanks very much

  11. Thanks to jsnetman from:

    monkeyx (27th March 2009)

  12. #25
    monkeyx's Avatar
    Join Date
    Nov 2006
    Posts
    364
    Thank Post
    8
    Thanked 52 Times in 41 Posts
    Rep Power
    25
    Quote Originally Posted by mullet_man View Post
    Cheers for the script monkeyx

    Will it shutdown machines that are locked? As our current psshutdown seems to struggle with locked machines.

    Cheers.
    It uses the force option from shutdown, so in theory yes?

    In theory could also shutdown ising WMI to force issue, but not sure if this would be more reliable?

    This script is a proof of concept for a c# application that will add extra functionality etc to force and monitor shutdown success.

  13. #26
    mullet_man's Avatar
    Join Date
    Oct 2005
    Location
    Oldham
    Posts
    726
    Thank Post
    34
    Thanked 46 Times in 45 Posts
    Rep Power
    26
    Quote Originally Posted by monkeyx View Post
    It uses the force option from shutdown, so in theory yes?

    In theory could also shutdown ising WMI to force issue, but not sure if this would be more reliable?

    This script is a proof of concept for a c# application that will add extra functionality etc to force and monitor shutdown success.
    Also whats the switch to allow the user to cancel, gonna find it now....

  14. #27
    sahmeepee's Avatar
    Join Date
    Oct 2005
    Location
    Greater Manchester
    Posts
    795
    Thank Post
    20
    Thanked 70 Times in 42 Posts
    Rep Power
    33
    Quote Originally Posted by GoldenWonder View Post
    We wrote a multi purpose system here. Every time anyone logs in it gets logged in an SQL server with the PC details/username/time etc. The trick is to store the MAC addresses etc as well for startup scripts.
    I was thinking of building that into our login logger database, but instead I decided to extract the MAC addresses from DHCP. When I run our wake-on-lan script (WoLLOP) it pulls all the MAC address / hostname pairs off our DHCP servers then uses that list to look up the hostname I've entered, so it just runs like:

    wollop computername

    Your method is nice too!

    Quote Originally Posted by browolf View Post
    what time do you shut them down?

    I have a scheduled script that does ours at 4pm but takes note of anyone logged in, doesnt shut them down and then a later scheduled script takes care of those ones.
    I do something similar. From hometime onwards a script repeatedly loops through all PCs, shutting down any that have no explorer.exe running (i.e. not logged on) and have been idle for more than 20 minutes. Late at night (about 23:30 I think) a different script runs with a psshutdown -f.

    I calculated that it's saving the school well over 10,000/year versus the laissez-faire approach.

  15. #28
    jsnetman's Avatar
    Join Date
    Oct 2007
    Posts
    887
    Thank Post
    23
    Thanked 134 Times in 126 Posts
    Rep Power
    39
    Tested Monkeyx's VB script on all curriculum machines as I left school tonight, it did it's job. I used to use another VB script to shutdown the machines at a scheduled time but this relied upon an updated list of machines on the network, thanks to this sript thats no longer necessary.

  16. #29
    jack0w's Avatar
    Join Date
    Jan 2008
    Posts
    123
    Thank Post
    12
    Thanked 4 Times in 4 Posts
    Rep Power
    14
    Can anyone give any pointers as to how I might exclude an entire sub OU from being shutdown? Have a lot of computers in the OU I wish to exclude and I'd rather not have to maintain a list again!

  17. #30

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,705
    Thank Post
    3,238
    Thanked 1,045 Times in 967 Posts
    Rep Power
    363
    Quote Originally Posted by jack0w View Post
    Can anyone give any pointers as to how I might exclude an entire sub OU from being shutdown? Have a lot of computers in the OU I wish to exclude and I'd rather not have to maintain a list again!
    Not sure if it will stop the script but blocking inheritance that or only apply it to the specific OU's

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

Similar Threads

  1. Script to shutdown computers.
    By FN-GM in forum Scripts
    Replies: 18
    Last Post: 17th November 2008, 03:43 PM
  2. Shutdown Script
    By andrew_91090 in forum Scripts
    Replies: 3
    Last Post: 1st October 2008, 02:03 PM
  3. Replies: 15
    Last Post: 8th September 2008, 01:43 PM
  4. Shutdown batch script stalls if 1 PC is shut down
    By PrimaryTech in forum Scripts
    Replies: 8
    Last Post: 7th July 2007, 06:04 PM
  5. Replies: 18
    Last Post: 14th October 2005, 09:28 AM

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
  •