Jump to content
Software FX Community

murray

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by murray

  1. Thanks! Works flawlessly (:
  2. If i execute c:\scritps\project\script.ps1 (when I'm standing in c:\) and the first line in that script is .\config.ps1 it wont work since config.ps1 is located in c:\scritps\project Therefore I want to do a "pwd" for the script.ps1 execution dir... How to?!
  3. Found the solution to MY problem .. You got it right, i wanted the uptime.. This is how i did it; $time=Get-WmiObject -class Win32_OperatingSystem$t=$time.ConvertToDateTime($time.Lastbootuptime)[TimeSpan]$uptime=New-TimeSpan $t $(get-date)"$($uptime.days)d $($uptime.hours)h $($uptime.minutes)m $($uptime.seconds)S" Saved this to uptime.ps1 and then ran; .\uptime.ps1 | out-gauge -type digital -refresh 0:0:1 -float Works just fine :-) thanks to both of you guys!
  4. Yes, I just solved it with a simular script. I searched the forum for some help and stumbled over (i think it was you) someones reply that you can't refresh a function but a script. Although i didn't do my script with a [datetime]-string... just echoed a normal string and presented it in out-gauge.. But i think I'm going to use you're code since my code do only count 30 days a month and 12*30 days a year. *EDIT* Just tested your lines and realized that thouse would show the uptime . What we need to do is extract the current time and subtract the bootuptime! I'll be back with an edit in a few minutes! *EDIT* Thank you alot!
  5. Hi, I've figured out how to get uptime in seconds but since it's kind of hard to figure out how long the system has been up over 600sec i would like to format it some. The commandline i used is: Get-WmiObject -class Win32_PerfFormattedData_PerfOS_System | Out-Gauge -value {$_.systemuptime/60/60/24} -type digital -refresh 0:0:1 -valueformat "##" That's a line for date, but i would like to add more... like YY-MM-DD HH:MM:SS or something like that.. but i just can't figure out a way to do it. Thanks!
×
×
  • Create New...