Add Exchange management Shell to “normal powershell
Here are a script, that you can include in yours script, to add Exchange management shell, to “normal” powershell scripts.
Kenneth Qvistgaard Dalbjerg, IT Konsulent i århus
Here are a script, that you can include in yours script, to add Exchange management shell, to “normal” powershell scripts.
import-module msonline(install-module msonline) $O365CREDS = Get-Credential$ONPREMCREDS = Get-Credential #used UPN Username $SESSION = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365CREDS -Authentication Basic -AllowRedirection Import-PSSession $SESSIONConnect-MsolService -Credential $O365CREDS #You can run these commands, to check...
Today i have a problem that an exchange will not send mails though TLS, no matter what i do. I find out that, somehow this exchange servers where creating new send connector, with forcehelo...
When you try to delete a mailbox, you may get this error:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
This mailbox database contains one or more mailboxes, mailbox plans, archive mailboxes, public folder mailboxes or arbitration mailboxes. To get a list of all mailboxes in this database, run the command Get-Mailbox -Database Database ID. To get a list of all mailbox plans in this database, run the command Get-MailboxPlan. To get a list of archive mailboxes in this database, run the command Get-Mailbox -Database Database ID -Archive. To get a list of all public folder mailboxes in this database, run the command Get-Mailbox -Database Database ID -PublicFolder. To get a list of all arbitration mailboxes in this database, run the command Get-Mailbox -Database Database ID -Arbitration. To disable a non-arbitration mailbox so that you can delete the mailbox database, run the command Disable-Mailbox Mailbox ID. To disable an archive mailbox so you can delete the mailbox database, run the command Disable-Mailbox Mailbox ID -Archive. To disable a public folder mailbox so that you can delete the mailbox database, run the command Disable-Mailbox Mailbox ID -PublicFolder. Arbitration mailboxes should be moved to another server; to do this, run the command New-MoveRequest Parameters. If this is the last server in the organization, run the command Disable-Mailbox Mailbox ID -Arbitration -DisableLastArbitrationMailboxAllowed to disable the arbitration mailbox. Mailbox plans should be moved to another server; to do this, run the command Set-MailboxPlan MailboxPlan ID -Database Database ID. + CategoryInfo : InvalidOperation: (Database ID:DatabaseIdParameter) [Remove-MailboxDatabase], AssociatedUserMailboxExistException + FullyQualifiedErrorId : [Server=Server,RequestId=RequestId,TimeStamp=TimeStamp] [FailureCategory=Cmdlet-AssociatedUserMailboxExistException] XXXXXXXX,Microsoft.Exchange.Management.SystemConfigurationTasks.RemoveMailboxDatabase + PSComputerName : Computer Name |
This is because the mailbox database still contains data, that need to be moved, before you can deleted it. If you...
I have a customer, where we have taken over the support from an old supplier, so we don’t know much about their background. The first thing we do, was to update the Exchange Server....
If you need to give auser access to users calendar, based on if there are member of an group, this is the way. Start Exchange Management Shell
1 2 3 4 5 6 7 8 9 10 11 |
$users = Get-ADGroupMember [groupname] | select -ExpandProperty name foreach ($user in $users) { $Mailbox = Get-Mailbox $user #The Calendar, is name "Kalender" in danish add-MailboxFolderPermission -identity “$($Mailbox.Name):\kalender” -AccessRights Editor -User [username] set-MailboxFolderPermission -identity “$($Mailbox.Name):\kalender” -AccessRights Editor -User [username] #English calendar add-MailboxFolderPermission -identity “$($Mailbox.Name):\calendar” -AccessRights Editor -User [username] set-MailboxFolderPermission -identity “$($Mailbox.Name):\calendar” -AccessRights Editor -User [username] } |
For en liste over alle mail adresse
1 |
Get-recipient -resultsize unlimited | select name -expand emailaddresses | select name,smtpaddress |
For en liste over alle mail adresse på et given domæne
1 |
Get-Recipient | Where{$_.EmailAddresses -match "it-grp.dk"} | select name -expand emailaddresses | select name,smtpaddress | where {$_ -match "kennethdalbjerg.dk"} |
if you want to export all you mailboxes sizes to CSV/Excel, you can run this command in you powershell:
1 |
get-mailbox | get-mailboxstatistics | select-object displayname, itemcount, totalitemsize | export-csv c:\mailbox-size.txt |
Sidste kommentar