Powershell Exchange Script

Hi Experts,

I have the following code:

Export-Mailbox –Identity "Mail" -PSTFolderPath C:\Mail\mail.user -Confirm:$false

Open in new window


I would like to add the creation date to the pst file that is created. Is this possible? Any help will be appreciated.

Regards,

introlux
introluxAsked:
Who is Participating?
 
Joseph DalyConnect With a Mentor Commented:
Should be able to do this.

$Today= Get-Date -format M-d-yyyy
Export-Mailbox –Identity "Mail" -PSTFolderPath C:\Mail\mail.user-$today -Confirm:$false
0
 
introluxAuthor Commented:
That will work but what if it is run the same day? this will overwrite the file. How can we timestamp this too?
0
 
introluxAuthor Commented:
$now = [datetime]::now.ToString('dd-MM-yyyy-HHMM')
0
 
introluxAuthor Commented:
Thanks!
0
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.

All Courses

From novice to tech pro — start learning today.