If you want to force the format output of a property, you should use one of the format cmdlets like Format-List or Format-Table. With those cmdlets you can create custom fields like you did in your Select-Object, but they will allow you to specify a format for the output. For a list of all the format specifiers look here. Here is a simplified example of how it would look.
Appreciate your response. I think it is working as suggested. However, i would make sure that it only displays the Date not the time. How do i make edit/filter my code to reject/trim the Time from the output for all the server entry?
Sorry but i am new to powershell and hence need your little help. Thanks.
However now i ran into an issue when i import the report in Excel. I am seeing a different format in excel for 2 date types:
13/02/2020 and 3/2/2020
Excel sheet filter these 2 dates on different categories and hence i am having issues filtering data for a given month/date. If we can make 3/2/2020 to 03/02/2020 may help me filter the data in excel.
Any idea how we can make sure all the date stamp comes in the same format so that excel doesnt confuses itself. ?
Please, when you post code format it as code using the code tags “PRE”, Thanks. You may (re-)read the instruction you find in the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!
You should edit your existing posts. Do not create new ones.
Thanks in advance.