Solved

Process Monitor Date \ Time \ Command Line Data

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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