Solved

Process Monitor Date \ Time \ Command Line Data

Posted on 2014-01-20
2
529 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 500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
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…

737 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