-
Notifications
You must be signed in to change notification settings - Fork 1
/
SPOC-morning.ps1
13 lines (9 loc) · 964 Bytes
/
SPOC-morning.ps1
1
2
3
4
5
6
7
8
9
10
Add-PSSnapin M*
$ONCALL = Get-DistributionGroupMember -Identity OnCallServerAdmin | ?{$_.name -like '*Paging*'-and $_.name -ne "PagingSysEngineers" -and $_.name -ne "PagingSESPOC" }
$ONCALL | Export-Csv \\vault\tech3\Scripts\Matt\OnCall.csv
Send-MailMessage -SmtpServer OA.corpdomain.com -Body "On Call - Change Over to Daytime SPOC" -To OnCallServerAdmin@corpdomain.com -From WinService@corpdomain.com -Subject "On Call Changeover"
foreach($contact in $ONCALL)
{Remove-DistributionGroupMember -Identity OnCallServerAdmin -Member $contact -Confirm:$false}
Add-DistributionGroupMember -Identity OnCallServerAdmin -Member PagingSESPOC
$members = Get-DistributionGroupMember -Identity OnCallServerAdmin | ?{$_.name -like '*Paging*'} | select name
Send-MailMessage -SmtpServer OA.corpdomain.com -Body "On Call - Change Over to Daytime SPOC{ $members" -To PagingSESPOC@corpdomain.com -From WinService@corpdomain.com -Subject "On Call Changeover"