+ Post New Thread
Results 1 to 6 of 6
Windows Thread, See how long startup scripts take to run in Technical; Hi, We have a few startup scripts running. One of them seems to be slowing things down abit. does anyone ...
  1. #1

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,054
    Thank Post
    888
    Thanked 1,729 Times in 1,492 Posts
    Blog Entries
    12
    Rep Power
    454

    See how long startup scripts take to run

    Hi,

    We have a few startup scripts running. One of them seems to be slowing things down abit. does anyone know of a way i can view how long each script is taking to execute?

    Thanks

  2. #2
    rh91uk's Avatar
    Join Date
    Sep 2008
    Location
    UK
    Posts
    877
    Thank Post
    137
    Thanked 132 Times in 114 Posts
    Rep Power
    36
    Try event viewer? See if any scripts are bombing out there, reporting problems? that's what I did when we were having a similar problem

  3. #3
    Quackers's Avatar
    Join Date
    Jan 2006
    Posts
    1,350
    Thank Post
    41
    Thanked 146 Times in 121 Posts
    Rep Power
    54
    Only thing i can think of is using Group Policy set "Show Startup Scripts Visable" then manually time it. You should see the command window pop up then. (If they are .bad based)

  4. #4

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    Yes this sort of thing can be a pain so what I have done in the past is pipe [ what I can ] in the script to a text / log file [ self de-bugging if you like ] that way I can see what has been done, and what not has been done etc. [ Code in some time stamps on lines or actions after they have been done ]
    You could always create a boot log as another option - knock up a script which monitors the other scripts, try and get that to run on a remote station to monitor......

  5. #5

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,225
    Thank Post
    875
    Thanked 2,717 Times in 2,302 Posts
    Blog Entries
    11
    Rep Power
    780
    This How to enable user environment debug logging in retail builds of Windows will create a very large log file of exactly how long each step takes during the logon process and is the most comprehensive way to do it. As it is scripts and probably a couple of slow operations in the script itself mattx's method will be able to tell you precicely what area of the offending script is causing the issue - assuming you add enough log checkin points.

    http://windowsitpro.com/article/arti...and-later.html

  6. #6

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    What I've done in the past is work out which script is going to run last (if you have multiple startup scripts) and then add code to look at the time the script finishes and the time the eventlog says Windows started. That's not a perfect guide to how long the machine took to start up but it's a good guide.
    Code:
      stTime=dateadd("n",-30,now)
      dt=year(date)&right("00"&month(date),2)&right("00"&day(date),2)
      atb = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias"
      sOffset=right("000" & oShell.RegRead(atb)*-1,3)
      stTime=dt & right("0" & hour(stTime),2)& right("0" & minute(stTime),2) & "00.000000+" & sOffset
      sql="SELECT * FROM Win32_NTLogEvent WHERE Logfile = 'system' and eventcode=6005 and timegenerated>='" & stTime & "'"
      Set wbemobjectset = GetObject("winmgmts:\\.").ExecQuery(sql)
      For Each wbemObject In wbemObjectSet
          sTime=wbemObject.TimeGenerated
      Next
      if sTime<>"" then
        sTime=left(sTime,4) & "-" & mid(sTime,5,2) & "-" & mid(sTime,7,2) & " " & (mid(sTime,9,2) & ":" & mid(sTime,11,2) & ":" & mid(sTime,13,2))
      else
        sTime="1900-01-01 00:00:00"
      end if
      ScriptRunTime=datediff("s",sTime,now)
    At the end of that bit, ScriptRunTime will be the number of seconds between the machine recording the 6005 "Windows is starting" event and the end of the script.

    It uses a WMI query to read the event log - I couldn't find a way to say "find the most recent startup event" so I get all startup events in the past 30 minutes and step through them; the last one is treated as the actual machine on time.

    If you log this to a database then you've got a record of how long each machine takes to start up (and also gives you a log of each time the machine boots)

SHARE:
+ Post New Thread

Similar Threads

  1. VBS startup scripts won't run
    By GoldenWonder in forum Windows
    Replies: 2
    Last Post: 10th September 2009, 10:38 PM
  2. Sofware deployments via startup scripts
    By Oops_my_bad in forum Windows Vista
    Replies: 1
    Last Post: 7th May 2009, 11:13 PM
  3. Another newbie NM question.....startup scripts..
    By Little-Miss in forum Learning Network Manager
    Replies: 17
    Last Post: 27th January 2009, 01:45 PM
  4. Startup scripts
    By djones in forum Windows
    Replies: 10
    Last Post: 27th February 2008, 12:18 AM
  5. Computer Startup Scripts
    By Spot in forum Windows
    Replies: 18
    Last Post: 16th November 2005, 11:06 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
  •