?
Solved

Process Monitor Date \ Time \ Command Line Data

Posted on 2014-01-20
2
Medium Priority
?
541 Views
Last Modified: 2014-01-20
Hi Everyone,

I am trying to output the process command line and date but the date format is in US, although running get-culture returns UK status.  There are two things I need to knowm, how I can change the date format to dd/mm/yyyy hh:mm:ss and to format the output to a readable table format. here is the script I have put to gether :

$a =  gwmi win32_process -computername localhost

$a | foreach-object{ $_.Name + " " + $_.commandline + " " + $_.ConvertToDateTime( $_.CreationDate )}
0
Comment
Question by:CaussyR
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
footech earned 2000 total points
ID: 39793914
If you want to be able to display it in a table format, you really need to keep the output as objects with their properties.  If you just output everything as strings then it's much less flexible, and will be subject to formatting problems due to the variable length of the information you want to output.  Using Select-Object and calculated properties is a good choice here.

I'm a little curious why you chose a WMI query to retrieve process information here instead of Get-Process.  It adds a little complexity to converting the datetime info.  But here's a method to get it in your desired format.
$a | Select Name,commandline,@{n="CreationDate";e={$_.ConvertToDateTime($_.CreationDate).ToString("dd/MM/yyyy HH:mm:ss")}}

Open in new window

0
 

Author Closing Comment

by:CaussyR
ID: 39794051
Thank you very much...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question