Change default format time dd/MM/yyy in script via Get-Culture?

Hi,

I have an html report in which I include dates.
Now these dates appear in month/day/year. I want to prevent to need to change every date to format dd/mm/yyyy.
Practical example in SCCM:(Get-CMDeployment -CollectionName $CollectionX).deploymenttime gives 11/15/2017 09:15:33
whereas it should be 15/11/...

Is there a way to set it in beginning of script so dates are in correct format?
Tried
Set-Culture -CultureInfo de-de but that does not work.

Please advise.
J.
janhoedtAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pankaj KumarSystems SpecialistCommented:
Hi Try this, where "d" is date format specifier

Get-CMDeployment -CollectionName $CollectionX | Select @{'N'= "deploymenttime"; 'E'= {$_.Deploymenttime.GetDateTimeFormats("d")[0]}}

there are other format specifier are available as well , refer on web http://msdn.microsoft.com/library/system.globalization.datetimeformatinfo.aspx
0
janhoedtAuthor Commented:
Well, that's exactly what I do not want to do. I do not want to change in each and every command the date.
I would like to set it by default in date/month/year regardless what script(s), functions or  modules  I use.
0
Pankaj KumarSystems SpecialistCommented:
Then Try below code in to set date time format. it will set datetime format for your profile and you will get required datetime format in your script output.

Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sShortDate -Value dd/MM/yyyy
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.