+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 26
Windows Thread, Released: Network Shutdown in Technical; Some of you might remember I posted in a thread about shutdowns recently, hinting about an automatic tool for CC3 ...
  1. #1
    bizzel's Avatar
    Join Date
    Jul 2007
    Location
    Cambridge
    Posts
    654
    Thank Post
    102
    Thanked 204 Times in 72 Posts
    Rep Power
    51

    Exclamation Released: Network Shutdown

    Some of you might remember I posted in a thread about shutdowns recently, hinting about an automatic tool for CC3 networks. Well here it is, finished and tested at Nobel.

    Network Shutdown 3 gives you the power to save energy, money and the environment by intelligently shutting down your RM network on a schedule. More efficient, less messy and faster than scripts, with a full GUI, safe list and logging. It automatically recognises your domain computers so there's no lists to maintain!

    You can download it from here: Network Shutdown at Paul Beesley

    I've made a real effort with this release to include thorough documentation so feedback on that is appreciated. I'm re-writing the AUP Informant and EduSweep documentation in the same format.
    Last edited by bizzel; 16th September 2008 at 07:37 PM.

  2. 2 Thanks to bizzel:

    MikeW (17th September 2008), Theblacksheep (17th September 2008)

  3. #2
    bizzel's Avatar
    Join Date
    Jul 2007
    Location
    Cambridge
    Posts
    654
    Thank Post
    102
    Thanked 204 Times in 72 Posts
    Rep Power
    51
    I should clarify why this is CC3 only as well. The program uses the PackageControl folder, a directory that contains .ini files for all domain desktops, to get its list of computers. That folder is only available on CC3 domain controllers.

    At startup the program locates the domain controller automatically to perform the search. In theory this will work from any computer but I recommend running it from a server.

    One advantage of using this method over active directory is that no servers or non-RM computers are included in the list.

    Oh, and here's a screenshot:


  4. Thanks to bizzel from:

    plexer (17th September 2008)

  5. #3

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,320
    Thank Post
    681
    Thanked 1,651 Times in 1,472 Posts
    Rep Power
    426
    Couldn't people that aren't on CC3 just duplicate this folder and .ini file structure on their dc's to emulate a cc3 network so the tool will work?

    Ben

  6. Thanks to plexer from:

    bizzel (17th September 2008)

  7. #4

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,320
    Thank Post
    681
    Thanked 1,651 Times in 1,472 Posts
    Rep Power
    426
    Or if you could see your way to including the use of a list of computers that would be cool and means everyone could use it.

    I like the idea of wmi to check if the machine is actually on to save waiting for something that isn't going to respond.

    Can this also be scheduled rather than run from the gui?

    Ben

  8. Thanks to plexer from:

    bizzel (17th September 2008)

  9. #5
    bizzel's Avatar
    Join Date
    Jul 2007
    Location
    Cambridge
    Posts
    654
    Thank Post
    102
    Thanked 204 Times in 72 Posts
    Rep Power
    51
    Quote Originally Posted by plexer View Post
    Or if you could see your way to including the use of a list of computers that would be cool and means everyone could use it.
    Yes, absolutely. I'm all for making it work on as many networks as possible in the long run. I originally wrote the program for our network alone and kept it as simple as possible, which is why it's using that folder.

    If I can find a way to query active directory easily I'll add that in. For the moment I'm concentrating on EduSweep and AUP Informant but I'll investigate at the very least.

    Quote Originally Posted by plexer View Post
    Can this also be scheduled rather than run from the gui?
    Yep. There's no built-in scheduler. If you run the program it'll start the process almost immediately (you have 10 seconds to abort). It's designed to be scheduled using Windows' own task scheduler, just use it to launch the .exe. That's documented in the manual as well for reference.

    And thanks, I thought the WMI tests were a cool idea.
    Last edited by bizzel; 17th September 2008 at 11:21 AM.

  10. #6

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,320
    Thank Post
    681
    Thanked 1,651 Times in 1,472 Posts
    Rep Power
    426
    I did a scan through the pdf but didn't see that

    Ben

  11. #7
    tech-man's Avatar
    Join Date
    Jul 2005
    Location
    The Pub
    Posts
    171
    Thank Post
    13
    Thanked 16 Times in 11 Posts
    Rep Power
    21
    OK if you have RM I spose!

  12. #8

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,320
    Thank Post
    681
    Thanked 1,651 Times in 1,472 Posts
    Rep Power
    426
    Quote Originally Posted by tech-man View Post
    OK if you have RM I spose!
    wtf is that supposed to mean?

    If you ain't got anything constructive to say then don't bother the man has allready said he wants to make it work on as many systems as possible.

    ffs.

    Ben

  13. #9

    Theblacksheep's Avatar
    Join Date
    Feb 2008
    Location
    In a house.
    Posts
    1,938
    Thank Post
    138
    Thanked 290 Times in 210 Posts
    Rep Power
    193
    Paul,

    I ran a test today at half 3, it went a little too well catching some pupils still logged in 'working', he he... Now scheduled the task for a little later in the evening.

    It only work on the FRDC, tested on two other DCs (inc the one with the packages) but it couldnt find the package list of those.

    Cheers

  14. #10

    russdev's Avatar
    Join Date
    Jun 2005
    Location
    Leicestershire
    Posts
    6,936
    Thank Post
    709
    Thanked 552 Times in 367 Posts
    Blog Entries
    3
    Rep Power
    204
    Give me a buzz and see if can get this working on cc3 (package control not used in cc4).

    Russ

  15. #11

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,320
    Thank Post
    681
    Thanked 1,651 Times in 1,472 Posts
    Rep Power
    426
    I presume with wmi you can also check to see if anyone is logged in but then you would have to run it later a second time anyway to catch any that were logged on the firstime.

    Unless using wmi you can schedule the shutdown on the local machine for later?

    Ben

  16. #12

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,205
    Thank Post
    876
    Thanked 2,729 Times in 2,308 Posts
    Blog Entries
    11
    Rep Power
    782
    Quote Originally Posted by plexer View Post
    I presume with wmi you can also check to see if anyone is logged in but then you would have to run it later a second time anyway to catch any that were logged on the firstime.

    Unless using wmi you can schedule the shutdown on the local machine for later?

    Ben
    I was also working on a simmilar bit of code that integrated into a larger program, here is some code that returns both the currently logged on user and how long the machine has been running. My code was to institute a safe list of users as well who would not be kicked off as well as ones that would be kicked off after a certain time.

    Code:
            private void button1_Click(object sender, EventArgs e)
            {//timespan object to store the result value
                TimeSpan uptimeTs = new TimeSpan();
                ManagementScope theScope = new ManagementScope("\\\\" + textBox3.Text); //computer name
    
                ObjectQuery theQuery = new ObjectQuery("SELECT username FROM Win32_ComputerSystem");
    
                ManagementObjectSearcher theSearcher = new ManagementObjectSearcher(theScope, theQuery);
    
                ManagementObjectCollection theCollection = theSearcher.Get();
    
                foreach (ManagementObject theCurObject in theCollection)
                {
                    textBox1.Text = theCurObject["username"].ToString(); //output currently logged on user
                }
                theQuery.QueryString = "SELECT LastBootUpTime FROM Win32_OperatingSystem";
    
                theSearcher.Query = theQuery;
    
                theCollection = theSearcher.Get();
    
                foreach (ManagementObject theCurObject in theCollection)
                {
                    DateTime lastBootUp;
    
                    DateTime date = DateTime.MinValue;
                    string wmiDate;
                    //check date integrity 
                    wmiDate = theCurObject["LastBootUpTime"].ToString();
                    if (wmiDate != null && wmiDate.IndexOf('.') != -1)
                    {
                        //obtain the date with miliseconds 
                        string tempDate = wmiDate.Substring(0, wmiDate.IndexOf('.') + 4);
    
                        //check the lenght 23 if (tempDate.Length == 18) 
                        {
                            //extract each date component 
                            int year = Convert.ToInt32(tempDate.Substring(0, 4));
                            int month = Convert.ToInt32(tempDate.Substring(4, 2));
                            int day = Convert.ToInt32(tempDate.Substring(6, 2));
                            int hour = Convert.ToInt32(tempDate.Substring(8, 2));
                            int minute = Convert.ToInt32(tempDate.Substring(10, 2));
                            int second = Convert.ToInt32(tempDate.Substring(12, 2));
                            int milisecond = Convert.ToInt32(tempDate.Substring(15, 3));
    
                            //compose the new datetime object 
                            lastBootUp = new DateTime(year, month, day, hour, minute, second, milisecond);
                            if (lastBootUp != DateTime.MinValue)
                                //get the diff between dates
                                uptimeTs = DateTime.Now - lastBootUp;
                            textBox2.Text = uptimeTs.Days.ToString() + "d " + uptimeTs.Hours.ToString() + "h " + uptimeTs.Minutes.ToString() + "m " + uptimeTs.Seconds.ToString() + "s ";
                        }
                    }
    
    
                    {
    
                    }
    
                }
            }
    It is quite rough as I got distracted but it should work. I also usually just grab a list of the currently active machines from the network browser service which prevents having to cycle through every machine even if it is not on. I can dig up that code to if you are interested.
    Last edited by SYNACK; 17th September 2008 at 05:00 PM.

  17. Thanks to SYNACK from:

    bizzel (17th September 2008)

  18. #13

    Theblacksheep's Avatar
    Join Date
    Feb 2008
    Location
    In a house.
    Posts
    1,938
    Thank Post
    138
    Thanked 290 Times in 210 Posts
    Rep Power
    193
    Quote Originally Posted by plexer View Post
    I presume with wmi you can also check to see if anyone is logged in but then you would have to run it later a second time anyway to catch any that were logged on the firstime.
    I did have reports earler of it shutting down 'live' machines....

  19. #14

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,104
    Thank Post
    891
    Thanked 1,752 Times in 1,511 Posts
    Blog Entries
    12
    Rep Power
    457
    If I can find a way to query active directory easily
    you could run a batch file to export a list of computes on a schedule, it will put them into a text file then get the program to read the text file.

  20. #15
    bizzel's Avatar
    Join Date
    Jul 2007
    Location
    Cambridge
    Posts
    654
    Thank Post
    102
    Thanked 204 Times in 72 Posts
    Rep Power
    51
    Quote Originally Posted by Theblacksheep View Post
    Paul,

    I ran a test today at half 3, it went a little too well catching some pupils still logged in 'working', he he... Now scheduled the task for a little later in the evening.

    It only work on the FRDC, tested on two other DCs (inc the one with the packages) but it couldnt find the package list of those.

    Cheers
    Yep, it is pretty indiscriminate. Again, something to work on. I found a bug that can stop the packagecontrol folder being detected by other machines and will roll a fix out soon.

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. GPupdate on shutdown.
    By boomam in forum Windows
    Replies: 9
    Last Post: 28th February 2008, 03:48 PM
  2. sample error at shutdown
    By macca in forum Windows
    Replies: 5
    Last Post: 25th September 2007, 09:45 AM
  3. Remote shutdown
    By Kained in forum Windows
    Replies: 9
    Last Post: 28th August 2007, 06:44 PM
  4. xp shutdown problem
    By Uraken in forum Windows
    Replies: 0
    Last Post: 22nd February 2007, 09:09 PM
  5. Christmas Shutdown
    By nawbus in forum Wireless Networks
    Replies: 16
    Last Post: 20th December 2005, 10:02 AM

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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