Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 206

Get UpTime from powershell into a usable way, but can't get it to work

$
0
0

I've been making this program where i need to send a command to powershell and in return it gives me the sys UpTime (minutes work better but not mandatory)

As i'm still not used to using powershell, i'm having a lot of problems in getting this intel.

This is what i tryed:

    (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime

Gives me the uptime, but i still have no idea how to work with that, so i still need to somehow add something like:

    | Select-String -Pattern "TotalMinutes"

But then i need (somehow) to make that powershell gives me that time as return so i can work with it.maybe to clipboard?

    | clip

But if i add all those up, none will work.Putting in the clipboard is just a way i made to get this info, others might also work.I'm still very new to this, sorry if i hurt your intellect with stupid questions.

Thanks in advance


Viewing all articles
Browse latest Browse all 206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>