Setup-SMTPGraphRelay.ps1 aktualisiert
This commit is contained in:
1 parent
74400d7d6e
commit
714ad13dae
1 file changed
+19
-19
+19
-19
@@ -1772,8 +1772,8 @@ function Manage-SmtpAuth {
|
||||
$p1 = Read-Host "Passwort" -AsSecureString
|
||||
$p2 = Read-Host "Passwort wiederholen" -AsSecureString
|
||||
|
||||
$plain1 = ConvertTo-PlainText -SecureString$p1
|
||||
$plain2 = ConvertTo-PlainText -SecureString$p2
|
||||
$plain1 = ConvertTo-PlainText -SecureString $2
|
||||
$plain2 = ConvertTo-PlainText -SecureString $2
|
||||
|
||||
try {
|
||||
if ($plain1.Length -lt 8) {
|
||||
@@ -1782,7 +1782,7 @@ function Manage-SmtpAuth {
|
||||
continue
|
||||
}
|
||||
|
||||
if ($plain1 -cne$plain2) {
|
||||
if ($plain1 -cne $2) {
|
||||
Write-Fail "Passwoerter stimmen nicht ueberein."
|
||||
Read-Host "Enter"
|
||||
continue
|
||||
@@ -1793,7 +1793,7 @@ function Manage-SmtpAuth {
|
||||
$plain2 =$null
|
||||
}
|
||||
|
||||
$record = New-SmtpPasswordRecord -Password$p1
|
||||
$record = New-SmtpPasswordRecord -Password $2
|
||||
|
||||
$newUser = [pscustomobject]@{
|
||||
Username = $username
|
||||
@@ -1840,8 +1840,8 @@ function Manage-SmtpAuth {
|
||||
$p1 = Read-Host "Neues Passwort" -AsSecureString
|
||||
$p2 = Read-Host "Passwort wiederholen" -AsSecureString
|
||||
|
||||
$plain1 = ConvertTo-PlainText -SecureString$p1
|
||||
$plain2 = ConvertTo-PlainText -SecureString$p2
|
||||
$plain1 = ConvertTo-PlainText -SecureString $2
|
||||
$plain2 = ConvertTo-PlainText -SecureString $2
|
||||
|
||||
try {
|
||||
if ($plain1.Length -lt 8) {
|
||||
@@ -1850,7 +1850,7 @@ function Manage-SmtpAuth {
|
||||
continue
|
||||
}
|
||||
|
||||
if ($plain1 -cne$plain2) {
|
||||
if ($plain1 -cne $2) {
|
||||
Write-Fail "Passwoerter stimmen nicht ueberein."
|
||||
Read-Host "Enter"
|
||||
continue
|
||||
@@ -1861,7 +1861,7 @@ function Manage-SmtpAuth {
|
||||
$plain2 =$null
|
||||
}
|
||||
|
||||
$record = New-SmtpPasswordRecord -Password$p1
|
||||
$record = New-SmtpPasswordRecord -Password $2
|
||||
$user.Salt =$record.Salt
|
||||
$user.PasswordHash =$record.PasswordHash
|
||||
$user.Iterations =$record.Iterations
|
||||
@@ -1897,7 +1897,7 @@ function Manage-SmtpAuth {
|
||||
|
||||
"6" {
|
||||
$current = @($config.Smtp.AllowUnauthenticatedNetworks) -join ","
|
||||
$input = Read-Default "Netze/IPs ohne AUTH, Komma getrennt; '-' fuer keine" $(if ($current) {$current } else { "-" })
|
||||
$input = Read-Default "Netze/IPs ohne AUTH, Komma getrennt; '-' fuer keine" $(if ($current) { $current } else { "-" })
|
||||
|
||||
if ($input -eq "-") {
|
||||
$config.Smtp.AllowUnauthenticatedNetworks = @()
|
||||
@@ -1942,7 +1942,7 @@ function Manage-SmtpAuth {
|
||||
# Config nach jeder Aenderung neu laden, damit Serialisierung/Arrays exakt
|
||||
# dem installierten Zustand entsprechen.
|
||||
$config = Get-RelayConfig -TargetPath $InstallPath
|
||||
$config = Ensure-SmtpAuthConfig -Config$config
|
||||
$config = Ensure-SmtpAuthConfig -Config $2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1950,13 +1950,13 @@ function Manage-SmtpAuth {
|
||||
function Invoke-FailureModeTests {
|
||||
Write-Title "SMTPGraphRelay - Failure Mode QA"
|
||||
|
||||
$tester = Join-Path$InstallPath "Test-SMTPGraphRelay-FailureModes.ps1"
|
||||
$tester = Join-Path $2 "Test-SMTPGraphRelay-FailureModes.ps1"
|
||||
if (-not (Test-Path -LiteralPath $tester)) {
|
||||
Write-Fail "Test-SMTPGraphRelay-FailureModes.ps1 ist nicht installiert."
|
||||
return
|
||||
}
|
||||
|
||||
& $tester -InstallPath$InstallPath
|
||||
& $tester -InstallPath $2
|
||||
}
|
||||
|
||||
function Uninstall-Relay {
|
||||
@@ -1978,7 +1978,7 @@ function Uninstall-Relay {
|
||||
Remove-NetFirewallRule -ErrorAction SilentlyContinue
|
||||
Write-Ok "SMTPGraphRelay Firewallregeln entfernt."
|
||||
|
||||
if ($config -and$config.Graph.CertificateThumbprint) {
|
||||
if ($config -and $2.Graph.CertificateThumbprint) {
|
||||
if (Confirm-Yes "Lokales Relay-Zertifikat $($config.Graph.CertificateThumbprint) entfernen?") {
|
||||
Remove-Item -LiteralPath "Cert:\LocalMachine\My\$($config.Graph.CertificateThumbprint)" -Force -ErrorAction SilentlyContinue
|
||||
Write-Ok "Lokales Zertifikat entfernt."
|
||||
@@ -2019,9 +2019,9 @@ function Uninstall-Relay {
|
||||
$currentInstaller = [IO.Path]::GetFullPath($PSCommandPath)
|
||||
$targetFull = [IO.Path]::GetFullPath($InstallPath)
|
||||
|
||||
foreach ($item in Get-ChildItem -LiteralPath$InstallPath -Force -ErrorAction SilentlyContinue) {
|
||||
foreach ($item in Get-ChildItem -LiteralPath $2 -Force -ErrorAction SilentlyContinue) {
|
||||
try {
|
||||
if ($item.FullName -eq$currentInstaller) {
|
||||
if ($item.FullName -eq $2) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -2061,7 +2061,7 @@ function Show-Status {
|
||||
}
|
||||
|
||||
try {
|
||||
$failedCount = @(Get-FailedQueueEntries -Config$config).Count
|
||||
$failedCount = @(Get-FailedQueueEntries -Config $2).Count
|
||||
Write-Host " Failed: $failedCount Mail(s)"
|
||||
} catch {}
|
||||
} catch {}
|
||||
@@ -2070,7 +2070,7 @@ function Show-Status {
|
||||
Write-Warn "Keine config.json vorhanden."
|
||||
}
|
||||
|
||||
$task = Get-ScheduledTask -TaskName$TaskName -ErrorAction SilentlyContinue
|
||||
$task = Get-ScheduledTask -TaskName $2 -ErrorAction SilentlyContinue
|
||||
if ($task) {
|
||||
Write-Host "Task State: $($task.State)"
|
||||
}
|
||||
@@ -2086,7 +2086,7 @@ function Show-Menu {
|
||||
|
||||
$installedVersion = Get-InstalledVersion -TargetPath $InstallPath
|
||||
|
||||
if ($installedVersion -and$installedVersion.Version) {
|
||||
if ($installedVersion -and $2.Version) {
|
||||
Write-Host "Installiert: $($installedVersion.Version)" -ForegroundColor DarkGray
|
||||
}
|
||||
|
||||
@@ -2146,4 +2146,4 @@ while ($true) {
|
||||
if ($choice -eq "0") {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user