Solved

Unable to get uptime for the machine

Posted on 2007-12-06
11
1,237 Views
Last Modified: 2010-04-21
Hi. I recently had a problem getting systeminfo to work. The issue was my path was incorrect. It was showing c:\ystem32, once I corrected it to c:\windows\system32, all was working fine. Now when I type in systeminfo in a cmd prompt, everything shows except the uptime. It has N/A instead of shwoing the actual uptime. Could this be because I moved the paging file to the Drive. I don't see the relation, but that is the only thing I changed on the PC.

Note: My path is still correct in case you wanted to know.

Thank you
0
Comment
Question by:Bro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 2

Assisted Solution

by:biztopia
biztopia earned 80 total points
ID: 20425235
I'm not sure where systeminfo gets it's info from, but I would expect it is WMI.  Try running this script and see if it returns the uptime.  It is using WMI.  

Cheers
D.
Option Explicit
 
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly	= &h20
 
Dim objWMIService, strWMIQuery, colWMIItems, Item, dtmBootTime, strUptime
 
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
strWMIQuery = "SELECT Description, Caption, LastBootUpTime FROM Win32_OperatingSystem"
Set colWMIItems = objWMIService.ExecQuery(strWMIQuery, "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
 
For Each item In colWMIItems
	dtmBootTime = WMIDateStringToDate(item.LastBootUpTime)
	strUptime = DateDiff("d", dtmBootTime, Now) & " Day(s)"
Next 
 
wscript.echo strUptime
 
Function WMIDateStringToDate(dtmDate)
	WMIDateStringToDate = CDate(Mid(dtmDate, 7, 2) & "/" & _
	Mid(dtmDate, 5, 2) & "/" & Left(dtmDate, 4) _
	& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
End Function

Open in new window

0
 
LVL 34

Assisted Solution

by:sramesh2k
sramesh2k earned 170 total points
ID: 20429408
0
 

Author Comment

by:Bro
ID: 20430485
Hi everyone. Thanks for getting back to me. tried both solutuins, nothing happening at all. Even the uptime.exe, nothing comes back. Weird, because I used to see my uptime when I used systeminfo within a cmd prompt. Now it doesn't display, just says N/A. Any other ideas? Thanks.
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 34

Assisted Solution

by:sramesh2k
sramesh2k earned 170 total points
ID: 20433246
Hi Bro,

My guess is that the WMI is not working correctly in your system. Click Start, Run - type "services.msc". Double-click "Windows Management Instrumentation" and set its Startup type to "Automatic" and click "Start" to start the service if it's in a stopped state.
0
 

Author Comment

by:Bro
ID: 20434708
Hi sramesh2k,
I verified and the WMI was set to automatic and was started. I stopped it, re-started it, same issue. What boggles my mind is when I had this problem the other time, but systeminfo wouldn't work, because my path was wrong, when I corrected it, it was working fine, now a few days ago, try it, now all gets displayed except the uptime. Weird. Thank for the tip. Would appreciate another good idea however. Have a good day.

Bro


0
 
LVL 34

Assisted Solution

by:sramesh2k
sramesh2k earned 170 total points
ID: 20436174
Bro,

Try the steps listed under "Re-registering the WMI components" in this article:

Repairing and re-registering the WMI:
http://windowsxp.mvps.org/repairwmi.htm
0
 

Author Comment

by:Bro
ID: 20439144
I tried that, same issue.
0
 
LVL 2

Assisted Solution

by:biztopia
biztopia earned 80 total points
ID: 20447531
I'd run Process Monitor (http://www.microsoft.com/technet/sysinternals/Utilities/ProcessMonitor.mspx) and then run systeminfo or uptime.  See if it gives any clues as to what is happening.
0
 
LVL 34

Accepted Solution

by:
sramesh2k earned 170 total points
ID: 20447541
See also:

Hey, Scripting Guy! How Can I Determine the Uptime for a Server?:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/aug05/hey0802.mspx
0
 

Author Comment

by:Bro
ID: 20453682
Thanks guys for getting back to me. Well process monitor couldn't give me any details, well as far as I know. I did download uptime.exe, it's ok, works well, saved it as a batch file. However, I hate it when something is not working on my PC. I always try to find out on my own, then I come here for answers. I would really like to know why the uptime is displaying N/A. Something must be turned off. I copied the systeminfo.exe file form my other PC to this one, same issue. I tried to look in services if there was something, nothing I found anyways. Thanks.
0
 

Author Closing Comment

by:Bro
ID: 31413331
Sorry about the point spread. I really appreciate everyone's input and help on this one. I re-formatted my PC a few days ago. Hadn't done a fresh install since Sept 2003. So I was well ovrdue. Thank you all.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XP won't boot 27 157
Can I use mobile broadband with my PC. What is required. 13 117
What is this Task? 4 151
A question on Active Directory LDS 4 26
cPanel is a Unix based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilizes a 3 tier structure that provides functionality for administrators, rese…
Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question