-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
305 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,28 @@ | ||
# Calendar ========================================================================================================================================================= | ||
|
||
function Clone-OoOMessage { | ||
param( | ||
[Parameter(Mandatory=$True, ValueFromPipeline=$True, HelpMessage="Mailbox from which to copy OoO messages (e.g. [email protected])")] | ||
[string] $SourceMailbox, | ||
[Parameter(Mandatory=$True, ValueFromPipeline=$True, HelpMessage="Mailbox on which to write copied OoO messages (e.g. [email protected])")] | ||
[string] $DestinationMailbox | ||
) | ||
|
||
$eolConnectedCheck = priv_CheckEOLConnection | ||
|
||
if ( $eolConnectedCheck -eq $true ) { | ||
$externalMessage = (Get-MailboxAutoReplyConfiguration -Identity $SourceMailbox).ExternalMessage | ||
$internalMessage = (Get-MailboxAutoReplyConfiguration -Identity $SourceMailbox).InternalMessage | ||
|
||
Set-MailboxAutoReplyConfiguration -Identity $DestinationMailbox -AutoReplyState "Enabled" -InternalMessage $internalMessage -ExternalMessage $externalMessage | ||
Get-MailboxAutoReplyConfiguration -Identity $DestinationMailbox | Select-Object -Property AutoReplyState,InternalMessage,ExternalMessage | ||
|
||
} else { | ||
Write-Error "`nCan't connect or use Microsoft Exchange Online Management module. `nPlease check logs." | ||
} | ||
|
||
} | ||
|
||
function Export-CalendarPermission { | ||
param( | ||
[Parameter(Mandatory=$False, ValueFromPipeline=$True, HelpMessage="Mailbox to analyze (e.g. [email protected])")] | ||
|
@@ -11,23 +34,24 @@ function Export-CalendarPermission { | |
) | ||
|
||
begin { | ||
$previousProgressPreference = $ProgressPreference | ||
Set-Variable ProgressPreference Continue | ||
|
||
$mboxCounter = 0 | ||
$arr_CalPerm = @() | ||
$eolConnectedCheck = priv_CheckEOLConnection | ||
|
||
if ( $eolConnectedCheck -eq $true ) { | ||
Set-Variable ProgressPreference Continue | ||
|
||
if ([string]::IsNullOrEmpty($SourceMailbox)) { | ||
Write-Host "WARNING: no mailbox(es) specified, I scan all the mailboxes, please be patient." -f "Yellow" | ||
Write-Warning "WARNING: no mailbox(es) specified, I scan all the mailboxes, please be patient." | ||
$All = $True | ||
} | ||
|
||
if ($All) { | ||
$SourceMailbox = Get-Mailbox -ResultSize Unlimited -WarningAction SilentlyContinue | ||
} | ||
} else { | ||
Write-Host "`nCan't connect or use Microsoft Exchange Online Management module. `nPlease check logs." -f "Red" | ||
Write-Error "`nCan't connect or use Microsoft Exchange Online Management module. `nPlease check logs." | ||
Return | ||
} | ||
} | ||
|
@@ -61,6 +85,8 @@ function Export-CalendarPermission { | |
} else { | ||
$arr_CalPerm | Out-Host | ||
} | ||
|
||
Set-Variable ProgressPreference $previousProgressPreference | ||
} | ||
} | ||
|
||
|
@@ -162,13 +188,15 @@ function Set-OoO { | |
Get-MailboxAutoReplyConfiguration -Identity $SourceMailbox | ||
|
||
} else { | ||
Write-Host "`nCan't connect or use Microsoft Exchange Online Management module. `nPlease check logs." -f "Red" | ||
Write-Error "`nCan't connect or use Microsoft Exchange Online Management module. `nPlease check logs." | ||
} | ||
|
||
} | ||
|
||
|
||
# Export Modules =================================================================================================================================================== | ||
# Export Modules and Aliases ======================================================================================================================================= | ||
|
||
Export-ModuleMember -Alias * | ||
Export-ModuleMember -Function "Clone-OoOMessage" | ||
Export-ModuleMember -Function "Export-CalendarPermission" | ||
Export-ModuleMember -Function "Set-OoO" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.