diff --git a/Start-SefaUtil.ps1 b/Start-SefaUtil.ps1 index cb3b244..8a67491 100644 --- a/Start-SefaUtil.ps1 +++ b/Start-SefaUtil.ps1 @@ -55,8 +55,10 @@ Website: http://www.johanveldhuis.nl Twitter: http://twitter.com/jveldh Change Log +v2.2 DEV VERSION + v2.0 02/09/2015 - Replaced Sefautil queries by SQL queries, introduced backup and restore solution, added new parameter digits, - added new button to suggest delelagates based on same manager. Added Skype for Business Server 2015 support. + added new button to suggest delegates based on same manager. Added Skype for Business Server 2015 support. Added button to switch pools and a lot of code optimization. V1.0, 08/08/2013 - Initial version #> @@ -170,6 +172,8 @@ $CB_POOLS = New-Object System.Windows.Forms.ComboBox $LB_POOLS = New-Object System.Windows.Forms.Label $BTN_CHG_POOLS = New-Object System.Windows.Forms.Button $BTN_SEARCH_DEL = New-Object System.Windows.Forms.Button +$GB_FWD_GROUP = New-Object System.Windows.Forms.Groupbox +$GB_SIMRING_GROUP = New-Object System.Windows.Forms.Groupbox $TB_FWD_DEST = New-Object System.Windows.Forms.TextBox $LB_FWD_DEST = New-Object System.Windows.Forms.Label $LB_TIME_FORMAT = New-Object System.Windows.Forms.Label @@ -224,7 +228,8 @@ $System_Drawing_Size.Width = 1000 $form.ClientSize = $System_Drawing_Size $form.DataBindings.DefaultDataSourceUpdateMode = 0 $form.Name = 'form' -$form.Text = 'Sefautil Gui 2.0' +$form.Text = 'Sefautil Gui 2.2-Dev' + $form.add_Load({initialize}) $tabControl1.DataBindings.DefaultDataSourceUpdateMode = 0 @@ -265,17 +270,50 @@ $tabMain.UseVisualStyleBackColor = $True $tabControl1.Controls.Add($tabMain) + +$GB_FWD_GROUP.DataBindings.DefaultDataSourceUpdateMode = 0 +$GB_FWD_GROUP.Enabled = $True +#$GB_FWD_GROUP.FormattingEnabled = $True +$System_Drawing_Point = New-Object System.Drawing.Point +$System_Drawing_Point.X = 375 +$System_Drawing_Point.Y = 28 +$GB_FWD_GROUP.Location = $System_Drawing_Point +$GB_FWD_GROUP.Name = "GB_FWD" +$System_Drawing_Size = New-Object System.Drawing.Size +$System_Drawing_Size.Height = 110 +$System_Drawing_Size.Width = 200 +$GB_FWD_GROUP.Size = $System_Drawing_Size +#$GB_FWD_GROUP.TabIndex = 25 + +$tabMain.Controls.Add($GB_FWD_GROUP) + +$GB_SIMRING_GROUP.DataBindings.DefaultDataSourceUpdateMode = 0 +$GB_SIMRING_GROUP.Enabled = $True +#$GB_SIMRING_GROUP.FormattingEnabled = $True +$System_Drawing_Point = New-Object System.Drawing.Point +$System_Drawing_Point.X = 375 +$System_Drawing_Point.Y = 133 +$GB_SIMRING_GROUP.Location = $System_Drawing_Point +$GB_SIMRING_GROUP.Name = "GB_SIMRING" +$System_Drawing_Size = New-Object System.Drawing.Size +$System_Drawing_Size.Height = 140 +$System_Drawing_Size.Width = 200 +$GB_SIMRING_GROUP.Size = $System_Drawing_Size +#$GB_SIMRING_GROUP.TabIndex = 25 + +$tabMain.Controls.Add($GB_SIMRING_GROUP) + $CB_SIM_RING_DEST.DataBindings.DefaultDataSourceUpdateMode = 0 $CB_SIM_RING_DEST.Enabled = $False $CB_SIM_RING_DEST.FormattingEnabled = $True $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 730 +$System_Drawing_Point.X = 750 $System_Drawing_Point.Y = 176 $CB_SIM_RING_DEST.Location = $System_Drawing_Point $CB_SIM_RING_DEST.Name = "CB_FWD_DEST" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 21 -$System_Drawing_Size.Width = 183 +$System_Drawing_Size.Width = 170 $CB_SIM_RING_DEST.Size = $System_Drawing_Size $CB_SIM_RING_DEST.TabIndex = 25 $CB_SIM_RING_DEST.add_Leave({SET_CHG_SIM_RING_DEST}) @@ -285,13 +323,13 @@ $CB_POOLS.DataBindings.DefaultDataSourceUpdateMode = 0 $CB_POOLS.Enabled = $True $CB_POOLS.FormattingEnabled = $True $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 730 +$System_Drawing_Point.X = 750 $System_Drawing_Point.Y = 200 $CB_POOLS.Location = $System_Drawing_Point $CB_POOLS.Name = "CB_POOLS" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 23 -$System_Drawing_Size.Width = 183 +$System_Drawing_Size.Width = 170 $CB_POOLS.Size = $System_Drawing_Size $CB_POOLS.TabIndex = 25 #$CB_POOLS.add_Leave({SET_CHG_POOLS}) @@ -299,7 +337,7 @@ $tabMain.Controls.Add($CB_POOLS) $LB_POOLS.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 566 +$System_Drawing_Point.X = 580 $System_Drawing_Point.Y = 200 $LB_POOLS.Location = $System_Drawing_Point $LB_POOLS.Name = 'LB_SIM_RING' @@ -504,21 +542,22 @@ $tabInfo.Controls.Add($LB_DIAGNOSTIC) $TB_FWD_DEST.DataBindings.DefaultDataSourceUpdateMode = 0 $TB_FWD_DEST.Enabled = $False $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 730 +$System_Drawing_Point.X = 750 $System_Drawing_Point.Y = 54 $TB_FWD_DEST.Location = $System_Drawing_Point $TB_FWD_DEST.Name = "TB_FWD_DEST" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 20 -$System_Drawing_Size.Width = 183 +$System_Drawing_Size.Width = 170 $TB_FWD_DEST.Size = $System_Drawing_Size $TB_FWD_DEST.TabIndex = 23 + $tabMain.Controls.Add($TB_FWD_DEST) $LB_FWD_DEST.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 566 +$System_Drawing_Point.X = 580 $System_Drawing_Point.Y = 54 $LB_FWD_DEST.Location = $System_Drawing_Point $LB_FWD_DEST.Name = "LB_FWD_DEST" @@ -569,8 +608,8 @@ $tabMain.Controls.Add($BTN_REM_TEAM_M) $TB_GRP_PICKUP_NR.DataBindings.DefaultDataSourceUpdateMode = 0 $TB_GRP_PICKUP_NR.Enabled = $False $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 730 -$System_Drawing_Point.Y = 83 +$System_Drawing_Point.X = 750 +$System_Drawing_Point.Y = 118 $TB_GRP_PICKUP_NR.Location = $System_Drawing_Point $TB_GRP_PICKUP_NR.Name = 'TB_GRP_PICKUP_NR' $System_Drawing_Size = New-Object System.Drawing.Size @@ -637,8 +676,9 @@ $tabMain.Controls.Add($LB_Users) $LB_GRP_PICKUP.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 566 -$System_Drawing_Point.Y = 88 +$System_Drawing_Point.X = 580 +$System_Drawing_Point.Y = 118 + $LB_GRP_PICKUP.Location = $System_Drawing_Point $LB_GRP_PICKUP.Name = 'LB_GRP_PICKUP' $System_Drawing_Size = New-Object System.Drawing.Size @@ -647,13 +687,15 @@ $System_Drawing_Size.Width = 183 $LB_GRP_PICKUP.Size = $System_Drawing_Size $LB_GRP_PICKUP.TabIndex = 17 $LB_GRP_PICKUP.Text = 'Group Pickup Number' -$LB_GRP_PICKUP.Visible = $false +#$LB_GRP_PICKUP.Visible = $false +$LB_GRP_PICKUP.Enabled= $false $tabMain.Controls.Add($LB_GRP_PICKUP) + $LB_SIM_RING.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 566 +$System_Drawing_Point.X = 580 $System_Drawing_Point.Y = 176 $LB_SIM_RING.Location = $System_Drawing_Point $LB_SIM_RING.Name = 'LB_SIM_RING' @@ -669,8 +711,8 @@ $tabMain.Controls.Add($LB_SIM_RING) $CB_DISABLE_ALL.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 380 -$System_Drawing_Point.Y = 207 +$System_Drawing_Point.X = 12 +$System_Drawing_Point.Y = 105 $CB_DISABLE_ALL.Location = $System_Drawing_Point $CB_DISABLE_ALL.Name = 'CB_DISABLE_ALL' $System_Drawing_Size = New-Object System.Drawing.Size @@ -678,16 +720,17 @@ $System_Drawing_Size.Height = 24 $System_Drawing_Size.Width = 104 $CB_DISABLE_ALL.Size = $System_Drawing_Size #$CB_DISABLE_ALL.TabIndex = 14 -$CB_DISABLE_ALL.Text = 'Disable all' +$CB_DISABLE_ALL.Text = 'Disable sim-ring' $CB_DISABLE_ALL.UseVisualStyleBackColor = $True -$tabMain.Controls.Add($CB_DISABLE_ALL) +$GB_SIMRING_GROUP.Controls.Add($CB_DISABLE_ALL) $CB_GRP_PICKUP.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 380 -$System_Drawing_Point.Y = 250 +$System_Drawing_Point.X = 580 +$System_Drawing_Point.Y = 88 + $CB_GRP_PICKUP.Location = $System_Drawing_Point $CB_GRP_PICKUP.Name = 'CB_GRP_PICKUP' $System_Drawing_Size = New-Object System.Drawing.Size @@ -705,8 +748,8 @@ $tabMain.Controls.Add($CB_GRP_PICKUP) $CB_SIM_RING.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 380 -$System_Drawing_Point.Y = 176 +$System_Drawing_Point.X = 12 +$System_Drawing_Point.Y = 75 $CB_SIM_RING.Location = $System_Drawing_Point $CB_SIM_RING.Name = 'CB_SIM_RING' $System_Drawing_Size = New-Object System.Drawing.Size @@ -719,14 +762,14 @@ $CB_SIM_RING.UseVisualStyleBackColor = $True $CB_SIM_RING.Visible = $false $CB_SIM_RING.add_CheckedChanged({SET_CHG_SIM_RING}) -$tabMain.Controls.Add($CB_SIM_RING) +$GB_SIMRING_GROUP.Controls.Add($CB_SIM_RING) $CB_SIM_RING_TEAM.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 380 -$System_Drawing_Point.Y = 145 +$System_Drawing_Point.X = 12 +$System_Drawing_Point.Y = 45 $CB_SIM_RING_TEAM.Location = $System_Drawing_Point $CB_SIM_RING_TEAM.Name = 'CB_SIM_RING_TEAM' $System_Drawing_Size = New-Object System.Drawing.Size @@ -738,7 +781,7 @@ $CB_SIM_RING_TEAM.Text = 'Simultaneous Ring Team' $CB_SIM_RING_TEAM.UseVisualStyleBackColor = $True $CB_SIM_RING_TEAM.Visible = $false $CB_SIM_RING_TEAM.add_CheckedChanged({SET_CHG_SIM_RING_TEAM}) -$tabMain.Controls.Add($CB_SIM_RING_TEAM) +$GB_SIMRING_GROUP.Controls.Add($CB_SIM_RING_TEAM) $BTN_REM_DEL.DataBindings.DefaultDataSourceUpdateMode = 0 @@ -796,8 +839,8 @@ $tabMain.Controls.Add($LB_SourceUsers) $CB_SIM_RING_DEL.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 380 -$System_Drawing_Point.Y = 114 +$System_Drawing_Point.X = 12 +$System_Drawing_Point.Y = 15 $CB_SIM_RING_DEL.Location = $System_Drawing_Point $CB_SIM_RING_DEL.Name = 'CB_SIM_RING_DEL' $System_Drawing_Size = New-Object System.Drawing.Size @@ -809,7 +852,7 @@ $CB_SIM_RING_DEL.Text = 'Simultaneous Ring Delegates' $CB_SIM_RING_DEL.UseVisualStyleBackColor = $True $CB_SIM_RING_DEL.add_CheckedChanged({SET_CHG_SIM_RING_DEL}) -$tabMain.Controls.Add($CB_SIM_RING_DEL) +$GB_SIMRING_GROUP.Controls.Add($CB_SIM_RING_DEL) $LB_DelegateUsers.Enabled = $False $LB_DelegateUsers.DataBindings.DefaultDataSourceUpdateMode = 0 @@ -833,8 +876,8 @@ $tabMain.Controls.Add($LB_DelegateUsers) $CB_FWD_TO_DEL.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 380 -$System_Drawing_Point.Y = 84 +$System_Drawing_Point.X = 12 +$System_Drawing_Point.Y = 75 $CB_FWD_TO_DEL.Location = $System_Drawing_Point $CB_FWD_TO_DEL.Name = 'CB_FWD_TO_DEL' $System_Drawing_Size = New-Object System.Drawing.Size @@ -846,7 +889,7 @@ $CB_FWD_TO_DEL.Text = 'Forward to delegates' $CB_FWD_TO_DEL.UseVisualStyleBackColor = $True $CB_FWD_TO_DEL.add_CheckedChanged({SET_CHG_FWD_TO_DEL}) -$tabMain.Controls.Add($CB_FWD_TO_DEL) +$GB_FWD_GROUP.Controls.Add($CB_FWD_TO_DEL) $LB_User_Details.DataBindings.DefaultDataSourceUpdateMode = 0 $LB_User_Details.FormattingEnabled = $True @@ -922,8 +965,8 @@ $tabMain.Controls.Add($BTN_Load) $CB_FWD_Immediate.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 380 -$System_Drawing_Point.Y = 54 +$System_Drawing_Point.X = 12 +$System_Drawing_Point.Y = 45 $CB_FWD_Immediate.Location = $System_Drawing_Point $CB_FWD_Immediate.Name = 'CB_FWD_Immediate' $System_Drawing_Size = New-Object System.Drawing.Size @@ -935,12 +978,14 @@ $CB_FWD_Immediate.Text = 'Forward Immediate' $CB_FWD_Immediate.UseVisualStyleBackColor = $True $CB_FWD_Immediate.add_CheckedChanged({SET_CHG_FWD_IMMEDIATE}) -$tabMain.Controls.Add($CB_FWD_Immediate) +$GB_FWD_GROUP.Controls.Add($CB_FWD_Immediate) + + $LB_User_ring_time.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 566 +$System_Drawing_Point.X = 580 $System_Drawing_Point.Y = 33 $LB_User_ring_time.Location = $System_Drawing_Point $LB_User_ring_time.Name = 'LB_User_ring_time' @@ -957,8 +1002,8 @@ $tabMain.Controls.Add($LB_User_ring_time) $CB_FWD_NOANSWER.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point -$System_Drawing_Point.X = 380 -$System_Drawing_Point.Y = 27 +$System_Drawing_Point.X = 12 +$System_Drawing_Point.Y = 15 $CB_FWD_NOANSWER.Location = $System_Drawing_Point $CB_FWD_NOANSWER.Name = 'CB_FWD_NOANSWER' $System_Drawing_Size = New-Object System.Drawing.Size @@ -970,7 +1015,7 @@ $CB_FWD_NOANSWER.Text = 'Forward No Answer' $CB_FWD_NOANSWER.UseVisualStyleBackColor = $True $CB_FWD_NOANSWER.add_CheckedChanged({SET_CHG_FWD_NO_ANSWER}) -$tabMain.Controls.Add($CB_FWD_NOANSWER) +$GB_FWD_GROUP.Controls.Add($CB_FWD_NOANSWER) $TB_User_Ringtime.DataBindings.DefaultDataSourceUpdateMode = 0 $TB_User_RingTime.Enabled = $False @@ -1128,7 +1173,8 @@ function initialize function ConnectSQL { - #Find ResourceId for user' param([string]$query) + #Find ResourceId for user' + param([string]$query) #Define connection string @@ -1186,7 +1232,8 @@ $EXPORT|Out-File $file function SRC_USER { - #Find ResourceId for user' param([string]$userid) + #Find ResourceId for user' + param([string]$userid) ConnectSQL -query "select ResourceId from Resource where UserAtHost = '$userid'" @@ -1198,7 +1245,7 @@ function SRC_USER #endregion -#region Functions to check is features are enabled +#region Functions to check if features are enabled function CHK_CALL_FWD_NO_ANSWER { if($mode -eq "restore") @@ -1316,7 +1363,7 @@ function CHK_FWD_IM { if($mode -eq "restore") { - + if($Settings.Contains("")) { $xmlSplitStart = $Settings -split "" @@ -1324,7 +1371,7 @@ function CHK_FWD_IM $xmlSplitList = $splitStart -split "" $splitList = $xmlSplitList[0] - + if($splitList.Contains("target uri=`"sip:")) { $start = $splitList.IndexOf("")) { $xmlSplitStart = $Setting -split "" @@ -1387,7 +1434,7 @@ function CHK_FWD_IM $TB_FWD_DEST.text = $FWD_NR } else{ - $LB_DelegateUsers.SelectedItem = $(Get-CsUser -DomainController $dc|? {$_.SipAddress -eq "sip:" + $FWD_NR}).DisplayName + $TB_FWD_DEST.text = "sip:" + $FWD_NR } } } @@ -1395,6 +1442,53 @@ function CHK_FWD_IM } } +function CHK_FWD_VM +{ + if($mode -eq "restore") + { + # JOHAN: This restore code is untested. + if($settings.contains("")) + { + $xmlsplitstart = $settings -split "" + $splitstart = $xmlsplitstart[1] + $xmlsplitlist = $splitstart -split "" + $splitlist = $xmlsplitlist[0] + if ($splitList -eq "") + { + $CB_FWD_Immediate.Checked = $true + $TB_FWD_DEST.text = "Voicemail" + } + } + } + else + { + #Verify if user has set the option to forward immediately to voicemail + ConnectSQL -query "select distinct UserAtHost,convert(varchar(4000),convert(varbinary(4000),Data)) ` + from PublishedStaticInstance,Resource ` + where PublisherId = '$ResourceId' and ResourceId = PublisherId and CategoryId = '8'` + and convert(varchar(4000),convert(varbinary(4000),Data)) ` + like '%%'" + + foreach ($Row in $data) + { + [string]$Setting = $Row[1] + if($Setting.Contains("")) + { + $xmlSplitStart = $Setting -split "" + $splitStart = $xmlSplitStart[1] + $xmlSplitList = $splitStart -split "" + $splitList = $xmlSplitList[0] + if ($splitList -eq "") + { + $CB_FWD_Immediate.Checked = $true + $TB_FWD_DEST.text = "Voicemail" + } + } + } + } +} + + function CHK_SIM_RING_DEL { if($mode -eq "restore") @@ -1725,6 +1819,8 @@ function CHK_FWD_DEL foreach ($Row in $data) { + + write-warning ("DELEGATE " + $row[1]) [string]$Setting = $Row[1] if($Setting.Contains("")) { @@ -2028,6 +2124,7 @@ function SET_CHG_FWD_NO_ANSWER $TB_FWD_DEST.Enabled = $false $TB_User_RingTime.Enabled = $false $TB_User_RingTime.Text = '' + $CB_DISABLE_ALL.Checked = $true #Logic here: for this to be false, the 'immediate' options must be active, therefor no SimRings are permissable $BTN_APPLY.Enabled = $true } } @@ -2040,6 +2137,7 @@ function SET_CHG_FWD_IMMEDIATE $LB_DelegateUsers.Enabled = $true $TB_FWD_DEST.Enabled =$true $BTN_APPLY.Enabled = $true + $CB_DISABLE_ALL.Checked = $true } elseif ($CB_FWD_Immediate.Checked -eq $false){ $LB_DelegateUsers.Enabled = $false @@ -2061,6 +2159,7 @@ function SET_CHG_SIM_RING_DEL $BTN_APPLY.Enabled = $true $BTN_REM_DEL.Enabled = $true $BTN_SEARCH_DEL.Enabled = $true + $CB_FWD_NOANSWER.Checked = $true } elseif ($CB_SIM_RING_DEL.Checked -eq $false){ $LB_DelegateUsers.Enabled = $false @@ -2084,6 +2183,7 @@ function SET_CHG_FWD_TO_DEL $BTN_APPLY.Enabled = $true $BTN_REM_DEL.Enabled = $true $BTN_SEARCH_DEL.Enabled = $true + $CB_DISABLE_ALL.Checked = $true } elseif ($CB_FWD_TO_DEL.Checked -eq $false){ $LB_DelegateUsers.Enabled = $false @@ -2105,10 +2205,12 @@ function SET_CHG_GRP_PICKUP $script:GRP_PICKUP = 'changed' if ($CB_GRP_PICKUP.Checked -eq $true){ $CB_GRP_PICKUP.Enabled = $true + $LB_GRP_PICKUP.Enabled = $true $TB_GRP_PICKUP_NR.Enabled = $true $BTN_APPLY.Enabled = $true } elseif ($CB_GRP_PICKUP.Checked -eq $false){ + $LB_GRP_PICKUP.Enabled = $false $TB_GRP_PICKUP_NR.Enabled = $false $BTN_APPLY.Enabled = $true } @@ -2125,6 +2227,7 @@ function SET_CHG_SIM_RING_TEAM $TB_User_RingTime.Enabled = $true $BTN_APPLY.Enabled = $true $BTN_REM_TEAM_M.Enabled = $true + $CB_FWD_NOANSWER.Checked = $true } elseif ($CB_SIM_RING_TEAM.Checked -eq $false){ $LB_DelegateUsers.Enabled = $false @@ -2143,6 +2246,7 @@ function SET_CHG_SIM_RING $LB_DelegateUsers.Enabled = $true $CB_SIM_RING_DEST.Enabled = $true $BTN_APPLY.Enabled = $true + $CB_FWD_NOANSWER.Checked = $true } elseif ($CB_SIM_RING.Checked -eq $false){ $LB_DelegateUsers.Enabled = $false @@ -2157,6 +2261,7 @@ function SET_FWD_NO_ANSWER_DEST if($TB_FWD_DEST.BackColor -eq [System.Drawing.Color]::FromArgb(255,191,205,219)){ $TB_FWD_DEST.BackColor = '' } + } function SET_CHG_SIM_RING_DEST @@ -2282,7 +2387,7 @@ function resetVariables $script:SIM_RING_TEAM = $NULL $script:SIM_RING = $NULL $script:SET_SIM_RING_DEST_CHANGED = $NULL - $script:SET_FWD_NOANSWER_DEST_CHANGED = $NULL + $script:SET_FWD_NO_ANSWER_DEST_CHANGED = $NULL $script:SET_DELEGATE = $NULL $script:REMOVE_DELEGATE = $NULL $script:GROUPID_CHANGED = $NULL @@ -2354,11 +2459,12 @@ function GetUserInfo $statusBar.text = 'status: Retrieving user info' $LB_User_Details.Items.Clear() $CB_FWD_Immediate.Checked = $false - $CB_FWD_NOANSWER.Checked = $false + $CB_FWD_NOANSWER.Checked = $true $CB_SIM_RING_DEL.Checked = $false $CB_FWD_TO_DEL.Checked = $false $CB_SIM_RING_TEAM.Checked = $false $CB_SIM_RING.Checked = $false + $CB_DISABLE_ALL.Checked = $true $CB_GRP_PICKUP.Checked = $false $LB_DelegateUsers.ClearSelected() $TB_FWD_DEST.Text = $NULL @@ -2396,6 +2502,7 @@ function GetUserInfo } CHK_CALL_FWD_NO_ANSWER CHK_FWD_IM + CHK_FWD_VM CHK_SIM_RING_DEL CHK_SIM_RING_TO CHK_FWD_DEL @@ -2517,7 +2624,7 @@ function APPLY $TB_LOG.Appendtext("$(Get-Date -format "dd-MM-yyyy HH:mm:ss")`t") $TB_LOG.Appendtext("Enabling forward no answer `r`n") $output = SEFAUTIL /Server:$pool $($getUserInfo.SipAddress.ToLower().Replace('sip:','')) /enablefwdnoanswer /setfwddestination:$($TB_FWD_DEST.text) /callanswerwaittime:$($TB_User_Ringtime.text) - $SET_FWD_NOANSWER_DEST_CHANGED = $NULL + $SET_FWD_NO_ANSWER_DEST_CHANGED = $NULL } Elseif($CB_FWD_NOANSWER.Checked -eq $false){ $TB_LOG.Appendtext("$(Get-Date -format "dd-MM-yyyy HH:mm:ss")`t") @@ -2626,7 +2733,16 @@ function APPLY } elseif($CB_SIM_RING_DEST.text -ne ""){ if ($CB_SIM_RING.Checked -eq $true){ - if ($CB_SIM_RING_DEST.SelectedItem -eq "Home"){ $output = SEFAUTIL /Server:$pool $($getUserInfo.SipAddress.ToLower().Replace('sip:','')) /setsimulringdestination:$((Get-CsAdUser -identity $getUserInfo.Identity).homePhone) /enablesimulring } elseif($CB_SIM_RING_DEST.SelectedItem -eq "IP"){ $output = SEFAUTIL /Server:$pool $($getUserInfo.SipAddress.ToLower().Replace('sip:','')) /setsimulringdestination:$((Get-CsAdUser -identity $getUserInfo.Identity).IPPhone) /enablesimulring } elseif($CB_SIM_RING_DEST.SelectedItem -eq "Mobile"){ $output = SEFAUTIL /Server:$pool $($getUserInfo.SipAddress.ToLower().Replace('sip:','')) /setsimulringdestination:$((Get-CsAdUser -identity $getUserInfo.Identity).MobilePhone) /enablesimulring } + if ($CB_SIM_RING_DEST.SelectedItem -eq "Home"){ + $output = SEFAUTIL /Server:$pool $($getUserInfo.SipAddress.ToLower().Replace('sip:','')) /setsimulringdestination:$((Get-CsAdUser -identity $getUserInfo.Identity).homePhone) /enablesimulring + + } + elseif($CB_SIM_RING_DEST.SelectedItem -eq "IP"){ + $output = SEFAUTIL /Server:$pool $($getUserInfo.SipAddress.ToLower().Replace('sip:','')) /setsimulringdestination:$((Get-CsAdUser -identity $getUserInfo.Identity).IPPhone) /enablesimulring + } + elseif($CB_SIM_RING_DEST.SelectedItem -eq "Mobile"){ + $output = SEFAUTIL /Server:$pool $($getUserInfo.SipAddress.ToLower().Replace('sip:','')) /setsimulringdestination:$((Get-CsAdUser -identity $getUserInfo.Identity).MobilePhone) /enablesimulring + } else { $temp = $CB_SIM_RING_DEST.text @@ -2697,11 +2813,12 @@ function APPLY } } - if($SET_FWD_NOANSWER_DEST_CHANGED -eq 'changed'){ + if($SET_FWD_NO_ANSWER_DEST_CHANGED -eq 'changed'){ if ($CB_FWD_NOANSWER.Checked -eq $true){ $statusBar.text = 'status: Changing forward no answer destination' $TB_LOG.Appendtext("$(Get-Date -format "dd-MM-yyyy HH:mm:ss")`t") $TB_LOG.Appendtext("Changing forward no answer destination`r`n") + $output = SEFAUTIL /Server:$pool $($getUserInfo.SipAddress.ToLower().Replace('sip:','')) /enablefwdnoanswer /setfwddestination:$TB_FWD_DEST } } @@ -2784,8 +2901,8 @@ function BACKUP_ALL function RESTORE_ALL { $TB_LOG.Appendtext("$(Get-Date -format "dd-MM-yyyy HH:mm:ss")`t") - $TB_LOG.Appendtext("Restore all proces started `r`n") - $statusBar.text = 'status: restore all proces started' + $TB_LOG.Appendtext("Restore all process started `r`n") + $statusBar.text = 'status: restore all process started' $script:restore = $true $users= Get-CsUser -DomainController $dc -resultsize unlimited|sort DisplayName foreach ($user in $users) @@ -2804,6 +2921,7 @@ function RESTORE_ALL CHK_CALL_FWD_NO_ANSWER CHK_FWD_IM + CHK_FWD_VM CHK_SIM_RING_DEL CHK_SIM_RING_TO CHK_FWD_DEL @@ -2813,5 +2931,6 @@ function RESTORE_ALL } } + #Call the Function GenerateForm \ No newline at end of file