Posted in
Exchange Server,
Windows Powershell |
No Comment | 1,639 views | 26/11/2014 11:10
You can export txt based config backups of your Exchange Server 2010 environment with following script.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| # Backup Accepted Domains
$AcceptedDomains = Get-AcceptedDomain | ConvertTo-Json
$AcceptedDomains | Set-Content -Path AcceptedDomains.txt
# Backup Mailboxes
$Mailboxes = Get-Mailbox | ConvertTo-Json
$Mailboxes | Set-Content -Path Mailboxes.txt
# Backup User Information
$Users = Get-User | ConvertTo-Json
$Users | Set-Content -Path Users.txt
# Backup Mailbox Permissions
$MailboxPermissions = Get-Mailbox | Get-MailboxPermission | where {$_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_.IsInherited -eq $false} | Select Identity,User,@{Name='Access Rights';Expression={[string]::join(', ', $_.AccessRights)}} | ConvertTo-Json
$MailboxPermissions | Set-Content -Path MailboxPermissions.txt
# Backup Mail Contacts
$MailContacts = Get-MailContact | ConvertTo-Json
$MailContacts | Set-Content -Path MailContacts.txt
# Backup Distribution Groups
$DistributionGroups = Get-DistributionGroup | Select *, @{label="Members";expression={($_ | Get-DistributionGroupMember).Name}} | ConvertTo-Json
$DistributionGroups | Set-Content -Path DistributionGroups.txt |
# Backup Accepted Domains
$AcceptedDomains = Get-AcceptedDomain | ConvertTo-Json
$AcceptedDomains | Set-Content -Path AcceptedDomains.txt
# Backup Mailboxes
$Mailboxes = Get-Mailbox | ConvertTo-Json
$Mailboxes | Set-Content -Path Mailboxes.txt
# Backup User Information
$Users = Get-User | ConvertTo-Json
$Users | Set-Content -Path Users.txt
# Backup Mailbox Permissions
$MailboxPermissions = Get-Mailbox | Get-MailboxPermission | where {$_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_.IsInherited -eq $false} | Select Identity,User,@{Name='Access Rights';Expression={[string]::join(', ', $_.AccessRights)}} | ConvertTo-Json
$MailboxPermissions | Set-Content -Path MailboxPermissions.txt
# Backup Mail Contacts
$MailContacts = Get-MailContact | ConvertTo-Json
$MailContacts | Set-Content -Path MailContacts.txt
# Backup Distribution Groups
$DistributionGroups = Get-DistributionGroup | Select *, @{label="Members";expression={($_ | Get-DistributionGroupMember).Name}} | ConvertTo-Json
$DistributionGroups | Set-Content -Path DistributionGroups.txt
I’ll also publish an import script to show you how to restore this config into your system again.