$key = 'from="192.168.1.*" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAETS7aLyp6mYBlVHvXHKFkU/ckJl61muKBfkOPVx98P claude-photobooth'
$admin = (whoami /groups) -match 'S-1-5-32-544'
if ($admin) { $file = "$env:ProgramData\ssh\administrators_authorized_keys" }
else { New-Item -ItemType Directory -Force "$env:USERPROFILE\.ssh" | Out-Null; $file = "$env:USERPROFILE\.ssh\authorized_keys" }
if (-not (Test-Path $file) -or -not (Select-String -Path $file -SimpleMatch 'claude-photobooth' -Quiet)) { Add-Content -Path $file -Value $key -Encoding ascii }
if ($admin) { icacls.exe $file /inheritance:r /grant '*S-1-5-32-544:F' /grant '*S-1-5-18:F' }
Write-Host "Ключ добавлен: $file" -ForegroundColor Green