ITguy565
asked on
Export-Mailbox + Powershell Script
Ladies and Gents,
I am looking to modify the following code:
The specific section would be the
I would like to do the following:
lets assume the following:
The Users Name is "John Smith"
Then I would like the pstfolderpath to read pstfolderpath c:\jsmith.pst
Assume that the Active Directory account name for John Smith does not contain jsmith as the return.
I am looking to modify the following code:
$content = get-content "c:\test.txt"
start-transcript C:\exportmailbox.txt
foreach ($user in $content){
$Access = (Get-Mailbox $user | Get-MailboxPermission | where {$_AccessRights -eq "FullAccess"}).User
if($Access -notcontains "domain\username"){
add-mailboxpermission -Id $user -User “testadmin” -AccessRights FullAccess -Deny:$false}
export-mailbox $user -IncludeFolders "\Inbox","\Sent Items","\Deleted Items" -pstfolderpath c:\$user._Mailbox.pst
stop-transcript}
The specific section would be the
pstfolderpath c:\$user._Mailbox.pst
I would like to do the following:
lets assume the following:
The Users Name is "John Smith"
Then I would like the pstfolderpath to read pstfolderpath c:\jsmith.pst
Assume that the Active Directory account name for John Smith does not contain jsmith as the return.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I mean what you want the name of the file to be? Is it the AD account name or "First letter of first name and last name" as in JSmith?
ASKER
Yes,
The file should be "jsmith.pst" even if the name in active directory says otherwise.
Thanks for you assistance thus far.
The file should be "jsmith.pst" even if the name in active directory says otherwise.
Thanks for you assistance thus far.
ok..then my script will do it..try that and let me know if your stuck.
ASKER
The script is perfect. Thanks, sorry it took me so long to get back to ya.
ASKER
if the AD already shows "jsmith" then leave the value jsmith.