Skip to content

Commit 36ad1be

Browse files
Update Transfer-DHCPScopes.ps1
Signed-off-by: LUIZ HAMILTON ROBERTO DA SILVA <[email protected]>
1 parent 1da0ffc commit 36ad1be

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

SysAdmin-Tools/Network-and-Infrastructure-Management/Transfer-DHCPScopes.ps1

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ function Import-DhcpScope {
172172

173173
if ($scopesToImport.Count -eq 0) {
174174
Write-Log "All scopes in $ImportFilePath already exist on $Server. No import performed." -Level "INFO"
175-
[Windows.Forms.MessageBox]::Show("All scopes already exist on $Server.`nNothing was imported.", "Info", "OK", "Information")
176175
$ProgressBar.Value = 100
176+
$null = [Windows.Forms.MessageBox]::Show("All scopes already exist on $Server.`nNothing was imported.", "Info", "OK", "Information")
177177
return "Skipped"
178178
}
179179

@@ -284,15 +284,19 @@ function Show-GUI {
284284
}
285285

286286
$cmbDomain.Add_SelectedIndexChanged({
287-
$cmbScope.Items.Clear()
288-
$txtServer.Text = Get-DHCPServerFromDomain $cmbDomain.SelectedItem
289-
if ($txtServer.Text) {
290-
Get-DhcpServerv4Scope -ComputerName $txtServer.Text | ForEach-Object {
291-
$cmbScope.Items.Add($_.ScopeId) | Out-Null
292-
}
287+
$cmbScope.Items.Clear()
288+
$txtServer.Text = Get-DHCPServerFromDomain $cmbDomain.SelectedItem
289+
if ($txtServer.Text) {
290+
Get-DhcpServerv4Scope -ComputerName $txtServer.Text | ForEach-Object {
291+
$cmbScope.Items.Add($_.ScopeId) | Out-Null
293292
}
294-
$btnExport.Enabled = $txtServer.Text -and $cmbScope.Text
295-
})
293+
}
294+
$btnExport.Enabled = $txtServer.Text -and $cmbScope.Text
295+
})
296+
297+
$cmbScope.Add_SelectedIndexChanged({
298+
$btnExport.Enabled = $txtServer.Text -and $cmbScope.Text
299+
})
296300

297301
$cmbImpDomain.Add_SelectedIndexChanged({
298302
$txtImpServer.Text = Get-DHCPServerFromDomain $cmbImpDomain.SelectedItem

0 commit comments

Comments
 (0)