0

I have a PowerShell script like this:

$owners = @{}
gwmi win32_process |% {$owners[$_.handle] = $_.getowner().user}
get-process | select processname,Id,StartTime,@{l="Owner";e={$owners[$_.id.tostring()]}}

I'd like to format the StartTime to appear as 24h format and dont show the seconds. How do I do that?

1 Answer 1

2

try this:

$owners = @{}
gwmi win32_process |% {$owners[$_.handle] = $_.getowner().user}
get-process | select processname,Id,@{l="StartTime";e={ get-date $($_.starttime) -f "dd/MM/yy HH.mm" }},@{l="Owner";e={$owners[$_.id.tostring()]}}
Sign up to request clarification or add additional context in comments.

1 Comment

Complementing a little @ruda here is the link with all the formatting options that can be used: technet.microsoft.com/en-us/library/ee692801.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.