Solved

Process Monitor Date \ Time \ Command Line Data

Posted on 2014-01-20
2
519 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
2 Comments
 
LVL 39

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
Synchronize a new Active Directory domain with an existing Office 365 tenant
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now