Powershell Exchange Script

introlux
introlux used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
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
introluxTechincal Director

Author

Commented:
That will work but what if it is run the same day? this will overwrite the file. How can we timestamp this too?
introluxTechincal Director

Author

Commented:
$now = [datetime]::now.ToString('dd-MM-yyyy-HHMM')
introluxTechincal Director

Author

Commented:
Thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial