Prev: vbs script to list files in a directory and email results
Next: RegOwner and RegCompany Objects of Win32_Product Class
From: moonhkt on 21 May 2010 12:50 Hi All My home computer take 6-7 mins to complete startup process. Before just 3 mins. Do you know how to check each startup process processing time by vbs ? Time to startup my computer. 1. Last Boot Up Time : 2010/05/21 12:20:54 PM 2. System Up Time : 00:07:33 3. Current Local Time : 2010/05/21 12:28:27 PM 1. Last Boot Up Time : 2010/05/21 11:36:06 PM 2. System Up Time : 00:06:52 3. Current Local Time : 2010/05/21 11:42:58 PM my uptime.vbs called by C:\Documents and Settings\Administrator\Start Menu\Programs\Startup\Startup.bat dim strComputer dim objWMIDateTime, objWMI, colOS , objOS strComputer = "." ' Local computer set objWMIDateTime = CreateObject("WbemScripting.SWbemDateTime") set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colOS = objWMI.InstancesOf("Win32_OperatingSystem") for each objOS in colOS objWMIDateTime.Value = objOS.LastBootUpTime Wscript.Echo _ "1. Last Boot Up Time : " & DateTimeStr(objWMIDateTime.GetVarDate) & chr(10) & _ "2. System Up Time : " & TimeSpan(objWMIDateTime.GetVarDate,Now) & chr(10) & _ "3. Current Local Time : " & DateYMD(date) & _ " " & FormatDateTime(now(),3) next Function DateTimeStr(dt) dim vstr DateTimeStr = dateYMD(dt) & " " & FormatDateTime(dt,3) end function Function DateYMD (dt) dim vstr vstr = Year(dt) & "/" & right("00" & Month(dt),2) & "/" & right("00" & Day(dt),2) DateYMD = vstr End function Function TimeSpan(dt1, dt2) Dim seconds Dim minutes dim hours dim day ' Function to display the difference between ' 2 dates in hh:mm:ss format If (isDate(dt1) And IsDate(dt2)) = false Then TimeSpan = "00:00:00" Exit Function End If seconds = Abs(DateDiff("S", dt1, dt2)) minutes = seconds \ 60 hours = minutes \ 60 minutes = minutes mod 60 seconds = seconds mod 60 if len(hours) = 1 then hours = "0" & hours if hours > "25" then day = hours \ 24 hours = hours mod 24 if len(hours) = 1 then hours = "0" & hours TimeSpan = " " & day & " Days, " & hours & ":" & _ RIGHT("00" & minutes, 2) & ":" & _ RIGHT("00" & seconds, 2) else TimeSpan = hours & ":" & _ RIGHT("00" & minutes, 2) & ":" & _ RIGHT("00" & seconds, 2) end if End Function
From: John John - MVP on 22 May 2010 06:48 I don't really know about the script that you are wanting to use but I can tell you that the Startup folder is almost certainly not right place to stick it! This is one of the *last* items processed when the computer boots so it won't be able to time other startup items, it will start long after other items have been processed. John moonhkt wrote: > Hi All > > My home computer take 6-7 mins to complete startup process. Before > just 3 mins. > Do you know how to check each startup process processing time by vbs ? > > Time to startup my computer. > 1. Last Boot Up Time : 2010/05/21 12:20:54 PM > 2. System Up Time : 00:07:33 > 3. Current Local Time : 2010/05/21 12:28:27 PM > 1. Last Boot Up Time : 2010/05/21 11:36:06 PM > 2. System Up Time : 00:06:52 > 3. Current Local Time : 2010/05/21 11:42:58 PM > > > my uptime.vbs called by C:\Documents and Settings\Administrator\Start > Menu\Programs\Startup\Startup.bat > > > dim strComputer > dim objWMIDateTime, objWMI, colOS , objOS > > strComputer = "." ' Local computer > > set objWMIDateTime = CreateObject("WbemScripting.SWbemDateTime") > set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") > set colOS = objWMI.InstancesOf("Win32_OperatingSystem") > for each objOS in colOS > objWMIDateTime.Value = objOS.LastBootUpTime > Wscript.Echo _ > "1. Last Boot Up Time : " & > DateTimeStr(objWMIDateTime.GetVarDate) & chr(10) & _ > "2. System Up Time : " & TimeSpan(objWMIDateTime.GetVarDate,Now) > & chr(10) & _ > "3. Current Local Time : " & DateYMD(date) & _ > " " & FormatDateTime(now(),3) > next > > Function DateTimeStr(dt) > dim vstr > DateTimeStr = dateYMD(dt) & " " & FormatDateTime(dt,3) > end function > > Function DateYMD (dt) > dim vstr > vstr = Year(dt) & "/" & right("00" & Month(dt),2) & "/" & > right("00" & Day(dt),2) > DateYMD = vstr > End function > > > Function TimeSpan(dt1, dt2) > Dim seconds > Dim minutes > dim hours > dim day > > ' Function to display the difference between > ' 2 dates in hh:mm:ss format > If (isDate(dt1) And IsDate(dt2)) = false Then > TimeSpan = "00:00:00" > Exit Function > End If > > seconds = Abs(DateDiff("S", dt1, dt2)) > minutes = seconds \ 60 > hours = minutes \ 60 > minutes = minutes mod 60 > seconds = seconds mod 60 > > if len(hours) = 1 then hours = "0" & hours > if hours > "25" then > day = hours \ 24 > hours = hours mod 24 > if len(hours) = 1 then hours = "0" & hours > TimeSpan = " " & day & " Days, " & hours & ":" & _ > RIGHT("00" & minutes, 2) & ":" & _ > RIGHT("00" & seconds, 2) > else > > TimeSpan = hours & ":" & _ > RIGHT("00" & minutes, 2) & ":" & _ > RIGHT("00" & seconds, 2) > end if > End Function
From: Mayayana on 22 May 2010 10:00
| | My home computer take 6-7 mins to complete startup process. Before | just 3 mins. | Do you know how to check each startup process processing time by vbs ? | As John John said, you won't get any chance to run until Windows is almost finished loading. There might be an option via NT logging. I don't know. Either way, VBS is not the way to deal with it. In my experience a big lag in boot time is usually connected with a driver conflict or "funkiness". Sometimes Windows just seems to get confused by certain drivers or combinations. At 2+- billion computations per second, I can't imagine what might take 10-15 seconds at boot time, with no disk activity. But that sort of thing is not unusual. Also see here: http://support.microsoft.com/kb/833721 That article explains boot.ini switch options. If you edit boot.ini to add extra boot options, each with different switches, you can get boot menu options like is possible in Win9x -- options to boot in safe mode, etc. (Why is everything so much more trouble in XP? I don't understand that.) By using the bootlog switch you can choose to log the steps taken during boot. I don't know whether that logs timing, but it does log what's loaded. Other thoughts: If it were me I'd look at what drivers/hardware have been installed lately. Also go to sysinternals.com and download Autoruns to weed you startup list. In most cases there's a lot of junk loading at startup. A great example is HP printers. These days I think they run about a half dozen junkware programs at startup, with few, if any, of them being necessary. Also, see here to clean up useless services: http://www.jsware.net/jsware/xpfix.php5 For more thorough info. see here: http://www.blackviper.com/ A default XP install loads dozens of services. Most of them are pointless and/or risky on a stand-alone PC. (Microsoft doesn't really sell different Windows versions. They just sell a single corporate workstation OS. Everyone else gets stuck with an inappropriate configuration.) As long as you understand the ramifications you can disable most services. But you must be careful. For instance, if you disable rpcss you won't be able to reboot. :) Most services probably don't take much time to load, but some might take time to go online. (Windows update maybe?) And there's a whole pile of useless junk called "simple tcp/ip services", under Control Panel -> Add/Remove... -> Add/Remove Windows Comp. -> Networking Services. Then there's junk like AV and anti-malware software, which is generally very bloated and of little value. Some of that may go looking for new AV defs at boot. And nowadays the majority of software is spyware, in the sense that it will go online without telling you if you don't specifically hunt down the way to stop it from doing so. With dozens of programs (including Windows itself) updating themselves willy nilly, without even telling you, it's a marvel that people can boot at all. My PC takes about 30 seconds or so to boot. There's no reason it should take several minutes. |