Page 1 of 2

System Uptime.

Posted: 19 Sep 2010 19:41
by SkyFrontier
Now we have a way to get XY uptime.
-the wording could state "XY uptime" instead of "Uptime".
-I was happily surprised when I saw "uptime" as "Various Information" (that displays equally system and XY info), but opposite to my expectations it was "XY uptime" only. Can this bit of information also be included in that report?
Thanks!

Re: System Uptime.

Posted: 19 Sep 2010 19:51
by aurumdigitus
SkyFrontier wrote:but opposite to my expectations it was "XY uptime" only. Can this bit of information also be included in that report?
By Jove, a jolly good thought! Beats having to start an exteral utility every time to that that info.

Re: System Uptime.

Posted: 19 Sep 2010 20:07
by admin
You guys are talking about the Windows uptime?

Re: System Uptime.

Posted: 19 Sep 2010 20:08
by SkyFrontier
admin wrote:You guys are talking about the Windows uptime?
Yep.

Re: System Uptime.

Posted: 19 Sep 2010 20:23
by aurumdigitus
Well I am. At the moment use WinElapsedTime.exe with a CKS, but having the feature rolled into XY would be one less utility to have to keep up to date.

Re: System Uptime.

Posted: 19 Sep 2010 20:59
by zer0
aurumdigitus wrote:Well I am. At the moment use WinElapsedTime.exe with a CKS, but having the feature rolled into XY would be one less utility to have to keep up to date.
XYplorer is not meant to be a replacement for other utilities ;)

Re: System Uptime.

Posted: 19 Sep 2010 21:34
by aurumdigitus
zer0 wrote:XYplorer is not meant to be a replacement for other utilities
Verily stated. It is sometimes easy to lose sight of the fact - especially given at it does - that XY is in the final analysis a file manager.

Still, parsing the thread would the average user find it of more valuable to know how the the program has been running or Windows has? :wink:

Re: System Uptime.

Posted: 19 Sep 2010 21:36
by zer0
aurumdigitus wrote:Still, parsing the thread would the average user find it of more valuable to know how the the program has been running or Windows has? :wink:
I'd rather know how long the program has been running.

Re: System Uptime.

Posted: 19 Sep 2010 21:53
by aurumdigitus
Fair enough.

De gustibus et coloribus non est disputandum!

Re: System Uptime.

Posted: 19 Sep 2010 22:41
by zer0
It's not arguing about tastes and colours. Within the context of XYplorer, we should be able to see how long it has been running and that is what we currently can do. Displaying system uptime falls outside the context of XYplorer. Further, simply justifying it based on having one less utility bears no fruit. By the same token, I could say that I'd like for XYplorer to tell me how much RAM I have installed and the clock speed of my CPU as I have a dedicated utility that does that and does it well.

Re: System Uptime.

Posted: 19 Sep 2010 23:43
by Stefan
Good suggestion zer0.

System UpTime
Processor Speed
Ram Max / free
Video resolution
Space on C: Max / free
...
(all what could be an problem with using XYplorer)


Having that info by hand would be nifty and would
be ready to copy into the forum to track down an problem.

I know and use several tools providing me such info, but all provide to much info,
and not only what is really interesting.

- - -

I did collect some technics and create an VBScript for getting this info.
Maybe someone want to have it?
Would need some cleanup, beautifying and errohandling (and also some
credits for an part of that code), but here is what i have till now. At least it works (for me).

If there is an interest i will clean it up and add some more infos.



Save this as plain text file with an VBS extension like 'SystemInfo.vbs'
Launch it like:
run "<xypath>\Tools\SystemInfo.vbs";
or
run "wscript <xypath>\Tools\SystemInfo.vbs";
or
open "<xypath>\Tools\SystemInfo.vbs";

Code: Select all

'Systeminfo v001

'Option Explicit
ON ERROR RESUME NEXT

strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colSettings = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colSettings 
    OSname = objOperatingSystem.Name 
    temp = split(OSname, "|")
    OSname = temp(0)
    OSname = Replace(OSname,"Microsoft Windows ","")
    
    OSversion = objOperatingSystem.Version 
    'OSSP = objOperatingSystem.ServicePackMajorVersion & "." & objOperatingSystem.ServicePackMinorVersion
    OSSP = objOperatingSystem.CSDVersion

    CodeSet = objOperatingSystem.CodeSet 
    CountryCode = objOperatingSystem.CountryCode
    OSLanguage = objOperatingSystem.OSLanguage
    CurrentTimeZone = objOperatingSystem.CurrentTimeZone
    Locale = objOperatingSystem.Locale    
    
    HostName = objOperatingSystem.CSName
    
    
    MemAvailPhy = round(objOperatingSystem.FreePhysicalMemory /1024, 2)  
Next

Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem in colItems
    CPUcurClock = round(objItem.CurrentClockSpeed /1024, 2)
    CPUname = trim(objItem.Name)
Next
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings 
    SysManu = objComputer.Manufacturer 
    SysModel = objComputer.Model 
    MemTotPhy = round(objComputer.TotalPhysicalMemory /1048576, 2) 
Next
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_Processor")
For Each objProcessor in colSettings 
    Proc = objProcessor.Description
Next


'///////////////////////
Dim colIPResults, oFile, FSO, oNIC, WMI, WSH, WSN, strAddresses, strIPAddress, strWQL
Set FSO = CreateObject("Scripting.FileSystemObject")
'Set WSN = CreateObject("WScript.Network")
Set WshS = WScript.CreateObject("WScript.Shell")
Set WMI = GetObject("WinMGMTS:root\cimv2")
strWQL = "SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'"
Set colIPResults = WMI.ExecQuery(strWQL)

For Each oNIC In colIPResults
  For Each strIPAddress in oNIC.IPAddress
        strAddresses = strAddresses & strIPAddress & "   "
  Next
Next

'If strAddresses ="0.0.0.0" Or strAddresses ="" or strAddresses = "undefined" Then
 '  strAddresses = "No Connection Detected"
'End If
'///////////////////////



'///////////////////////////
Dim Drv,Dtype,Dfree,Dtot,Dname,Dpct,Dused,Dserial,Dinfo

For each Drv in FSO.Drives
  If Drv.DriveType=0 Then Dtype="Unknown   "
  If Drv.DriveType=1 Then Dtype="Removable"
  If Drv.DriveType=2 Then Dtype="Fixed           "
  If Drv.DriveType=3 Then Dtype="Network      "
  If Drv.DriveType=4 Then Dtype="CD-ROM    "
  If Drv.DriveType=5 Then Dtype="RAM Disk   "
  
  If Drv.DriveType<3 Then
  
  If Drv.IsReady Then
    If Drv.DriveType=4 Then
      Dfree="N/A"
    ElseIf Drv.FreeSpace<1024^2 Then
      Dfree=FormatNumber(Drv.FreeSpace/1024,0)&" KB"
    ElseIf Drv.FreeSpace<10240^2 Then
      Dfree=FormatNumber(Drv.FreeSpace/(1024^2),2)&" MB"
    Else
      Dfree=FormatNumber(Drv.FreeSpace/(1024^2),0)&" MB"
    End If
    If Drv.TotalSize<1024^2 Then
      Dtot=FormatNumber(Drv.TotalSize/1024,0)&" KB"
    ElseIf Drv.TotalSize<10240^2 Then
      Dtot=FormatNumber(Drv.TotalSize/(1024^2),2)&" MB"
    Else
      Dtot=FormatNumber(Drv.TotalSize/(1024^2),0)&" MB"
    End If
    If Drv.VolumeName="" Then
      Dname="(None)"
    Else
      Dname=Drv.VolumeName
    End If
    Dused=Drv.TotalSize-Drv.FreeSpace
    If Dused<1024^2 Then
      Dused=FormatNumber(Dused/1024,0)&" KB"
    ElseIf Dused<10240^2 Then
      Dused=FormatNumber(Dused/(1024^2),2)&" MB"
    Else
      Dused=FormatNumber(Dused/(1024^2),0)&" MB"
    End If
    If Drv.DriveType=4 Then
      Dpct="N/A"
    Else
      Dpct=FormatPercent(Drv.FreeSpace/Drv.TotalSize,1)
    End If
    If Drv.DriveType=5 Then
      Dserial="N/A"
    Else
      Dserial=Hex(Drv.SerialNumber)
    End If
    Dinfo=Dinfo&"Drive "&Drv.DriveLetter&": " & Drv.FileSystem & vbTab & "Total Size: " _
    & Dtot & vbTab & " Free Space: " & Dfree & vbCRLF
  Else
    Dinfo=Dinfo&"Drive "&Drv.DriveLetter&_
      ":"&vbTab&vbTab&vbTab&_
      "Drive Type:  "&Dtype&vbTab&_
      "(No Media in Drive)"&vbCRLF&vbCRLF
  End If
 End If 'Drv.DriveType<3
Next

'///////////////////////////
Dim gfx, colours, horiz, vert
Set colItems = objWMIService.ExecQuery ("Select * From Win32_DisplayConfiguration")
For Each objItem in colItems
  gfx =  objItem.DeviceName
  colours =  objItem.BitsPerPel
  horiz =  objItem.PelsWidth
  vert =  objItem.PelsHeight
Next
'///////////////////////////

Function GetUpTime()
On Error Resume Next
Dim strComputer, objWMIService, colOperatingSystems, objOS, intSystemUptime
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("Select * From Win32_PerfFormattedData_PerfOS_System")

For Each objOS in colOperatingSystems
    intSystemUptime = Int(objOS.SystemUpTime / 60)
    'Wscript.Echo intSystemUptime & " minutes"
    GetUpTime = round(intSystemUptime / 60)
Next
End Function
'///////////////////////////

Output = Output & "Host name: "         & vbTab & HostName & vbCRLF
Output = Output & "IP-Address: "       & vbTab &  strAddresses & vbCRLF

Output = Output & "PC model: "         & vbTab &  SysModel & vbCRLF
Output = Output & "OS name: "          & vbTab &  OSname  & " " & OSSP & vbCRLF 
Output = Output & vbCRLF
Output = Output & "Processor: "        & vbTab &  CPUname & vbCRLF
Output = Output & "Total Phy Mem: " & vbTab &  MemTotPhy & " MB    "  _
                          & "Available: " &  MemAvailPhy & " MB" & vbCRLF
Output = Output & "System up for: " & vbTab &  "~ " & GetUpTime  & " hours, ~ " _
                         & round(GetUpTime /24) & " days."  & vbCRLF

Output = Output & vbCRLF & Dinfo & vbCRLF

Output = Output & "Grafik: "          & vbTab & gfx & "   " & horiz & "x" & vert & "@" _
                          & colours & " bit" & vbCRLF

'Output = Output & "CodeSet: "     & vbTab &  CodeSet  &  vbCRLF
'Output = Output & "CountryCode: " & vbTab &  CountryCode &  vbCRLF
'Output = Output & "OSLanguage: "  & vbTab &  OSLanguage &  vbCRLF
'Output = Output & "TimeZone: "    & vbTab &  CurrentTimeZone &  vbCRLF
'Output = Output & "Locale: "      & vbTab &  vbTab &  Locale    &  vbCRLF

'EDIT: "Press OK button to copy to clipboard"

'MsgBox Output, ,"Systeminfo"
Output = Output & vbCRLF &  vbCRLF & vbTab & vbTab & "     Press OK button to copy to clipboard"   
cb = MsgBox (Output, vbOKCancel +vbInfo ,"Systeminfo")
if cb = vbOK Then
  Set objHTML = CreateObject("InternetExplorer.Application")
  objHTML.Navigate ("about:blank")
  objHTML.Document.ParentWindow.ClipboardData.SetData "Text" , Output
End If
EDIT: added "Press OK button to copy to clipboard"

Re: System Uptime.

Posted: 20 Sep 2010 00:22
by aurumdigitus
Does this :wink: not mean the comment was made in good humor if not out-right jest? :roll:

Re: System Uptime.

Posted: 20 Sep 2010 00:27
by SkyFrontier
@Stefan:
Well. What to say?
It's better having a .vbs (I may be able to launch via CKS? "Run/Open"? Have to test later) than a completely external tool to accomplish such trivial-despite-important-to-me task.
So once again - a huge thank you!

Re: System Uptime.

Posted: 20 Sep 2010 00:39
by SkyFrontier
Note to new users:
above script is a VBS script.
So you may want to copy it as a normal .txt file, rename its extension to something like "systemInfo.VBS", put it under a specific folder and attach it as a CTB/UDC like this:

Code: Select all

open "<xydata>\Scripts\NonXY\SystemInfo.vbs";
-command RUN will not work; LOAD is intended for XY scripts (.XYS) only.

Re: System Uptime.

Posted: 20 Sep 2010 09:30
by admin
I think adding OS Uptime here can be justified. :)