Загрузка данных


foreach ($f in @("C:\ProgramData\ssh\administrators_authorized_keys", "$env:USERPROFILE\.ssh\authorized_keys")) {
  if (Test-Path $f) {
    $text = [System.IO.File]::ReadAllText($f)
    $text = $text -replace 'from="192\.168\.1\.\*"', 'from="192.168.*"'
    [System.IO.File]::WriteAllText($f, $text, (New-Object System.Text.UTF8Encoding($false)))
    Write-Host "Поправлен: $f" -ForegroundColor Green
    Get-Content $f | ForEach-Object { $_.Substring(0, [Math]::Min(60, $_.Length)) + "..." }
  }
}
Restart-Service sshd
Write-Host "sshd перезапущен" -ForegroundColor Green