True Percent Uptime

This script calculates the percentage of time a computer has been running, it does not just return the amount of time since last reboot.

4.5 Star
3,510 times
Add to favorites
E-mail Twitter Digg Facebook
  • Greate!
    1 Posts | Last post February 27, 2020
  • Is there a way to e-mail this out so we can automate this
    1 Posts | Last post April 02, 2019
    • Good morning, currently I run this script 
      Get-Content names.txt | foreach {.\getServerUptime.ps1 $_ -NumberOfDays 30} 
      where I have multiple computer names in a text file.
      I would like to automate this with e-mail so I receive a report once month.
  • Not able to execute for set of servers
    5 Posts | Last post September 11, 2017
    • Hi, I am able to run for single server wherein if i go for multiple servers using the Get-Content input.txt | foreach {.\Uptime.ps1 $_} option. it stops when any one server not responds..Script is not completing complete list of servers.. Could you please help in that.. 
    • Try setting your $ErrorPreference to "Continue" or "SilentlyContinue".
    • My previous answer was not accurate. This script, as written, cannot handle unresponsive computers. I need to fix this and post an update.
    • Thank you james for your reply.. I will wait for your further update on this script.. It is really useful and faster in fetching the outputs.. I have tested few other scripts but it takes lots of time..
    • Hello James, Any update. Thanks
  • where to add "Get-Content names.txt | foreach {.\getServerUptime.ps1 $_}" I n the script
    1 Posts | Last post August 17, 2017
    • where to add "Get-Content names.txt | foreach {.\getServerUptime.ps1 $_}" I n the script
  • we can take report a list of servers
    3 Posts | Last post March 14, 2017
    • Dear James,
            First of all thanks for your uploaded getServerUptime.ps1 script file. And this script was awesome to find out the server’s detail.
                        I can execution the script perfectly and am getting report also. My question is, it possible to take list of servers up-time details??
                        In my organization have more servers are there, is it possible to generate report my 1 attempt  by using this script.  
      Thanks & Regards,
      Vishnu, P
    • Certainly.  Try this:
      Get-Content names.txt | foreach {.\getServerUptime.ps1 $_}
      Where names.txt is a text file containing computer names and is located in the same folder as the PowerShell script.
    • No. It is ends there itself if any server not reachable.. any suggestions
  • Has anyone taken a crack at the Invoke-Command conversion to Get-Eventlog?
    1 Posts | Last post September 14, 2016
    • I would really like to use this incredible script, but I have no WinRM capabilities here, and I am not proficient enough of a PS'er to make the conversion. I have tried umpteen hundreds of iterations, but cannot get it to work. Anyone else been successful and would want to share the converted code??
  • Getting error
    2 Posts | Last post May 02, 2016
    • James, Wonder full script. exactly what I was looking for. But I am getting the below error when I test it on my laptop win7.
      PS C:\Powershell Scripts> .\getServerUptime.ps1
      WARNING: Unable to connect - LAPTOP1
      Kindly help.
    • Your computer (LAPTOP1) failed the first connectivity test: Test-Connection -ComputerName $ComputerName -Count 1 -TimeToLive 10 -Quiet
  • get up time for a server for a range of days
    2 Posts | Last post May 02, 2016
    • Hi,
      thanks for this script it is, very helpful, i am just wondering if i can execute this script to calculate the up time for a server through a range of days.
    • There is already a parameter for NumOfDays which allows you to calculate the uptime for the last "n" days. If you need to also be able to supply a custom start date, you will need to implement that yourself.
  • Help with script
    4 Posts | Last post December 08, 2013
    • James, first off nice work on this script.  
      Have a few problem, we have an environment with 4000 servers and i would like to use this script, we don't have winrm remote turned on and security won't allow it.  How can i modify this script to not require winrm and how can i output this to an html report or csv?  i know this is pretty old but hoping someone can help...
    • To work around these security concerns, you can remove the Invoke-Command statements and replace them with the built-in Get-EventLog -ComputerName syntax.  This will only require modification of 4 lines of code.
      Writing the output to CSV or HTML is a very simple affair.  I will leave this as your homework, but I suggest looking into the ConvertTo-CSV cmdlet and its HTML counterpart.
    • Very useful script, I have tested in the Winrm enabled environment it works well.
      Now wanted to run this script without turning ON winrm, Did happened you to modify “Invoke-Command statements” to the built-in Get-EventLog -ComputerName syntax if its yes it would be great if you could share the script with me
      Thank you
      Email -
    • Sorry, but no.  I do not plan to modify the script to eliminate the WinRM calls.  If you want to run the script in a non-WinRM environment, please download the script and modify it as per my suggestion above.
  • export into SQL
    2 Posts | Last post March 10, 2013
    • Hi James,
      beautiful script. We do, however, have problems getting it into SQL due to the output formatting. Is there a way to output the results as tab delimited, e.g. Name: server.local | NumOfDays: 30 | NumOfCrashes: 0 and so forth (where "|" represents a tab)?
      Thanks so much
    • The output of the script is an object.  As such, you can format the results however you wish.
1 - 10 of 17 Items