snippet netbird-claude-install: перевод Public→Private перед WinRM, try/catch на Set-Item WSMan
This commit is contained in:
@@ -84,13 +84,19 @@ Enable-NetFirewallRule -DisplayGroup "Remote Desktop" -ErrorAction SilentlyConti
|
||||
|
||||
# ===== 6. WinRM + OpenSSH Server =====
|
||||
Write-Host "[6/7] WinRM + OpenSSH Server..."
|
||||
# Сначала перевести Public-сети в Private (иначе Set-Item WSMan ругается)
|
||||
try {
|
||||
Get-NetConnectionProfile -ErrorAction SilentlyContinue | `
|
||||
Where-Object { $_.NetworkCategory -eq 'Public' } | `
|
||||
Set-NetConnectionProfile -NetworkCategory Private -ErrorAction SilentlyContinue
|
||||
} catch {}
|
||||
try {
|
||||
Enable-PSRemoting -Force -SkipNetworkProfileCheck | Out-Null
|
||||
} catch {
|
||||
winrm quickconfig -force -q | Out-Null
|
||||
try { winrm quickconfig -force -q | Out-Null } catch {}
|
||||
}
|
||||
Set-Item WSMan:\localhost\Service\Auth\Basic -Value $true -Force -ErrorAction SilentlyContinue
|
||||
Set-Item WSMan:\localhost\Service\AllowUnencrypted -Value $true -Force -ErrorAction SilentlyContinue
|
||||
try { Set-Item WSMan:\localhost\Service\Auth\Basic -Value $true -Force -ErrorAction SilentlyContinue } catch {}
|
||||
try { Set-Item WSMan:\localhost\Service\AllowUnencrypted -Value $true -Force -ErrorAction SilentlyContinue } catch {}
|
||||
# LocalAccountTokenFilterPolicy — чтобы локальный admin claude мог в WinRM
|
||||
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" `
|
||||
-Name "LocalAccountTokenFilterPolicy" -Value 1 -PropertyType DWord -Force | Out-Null
|
||||
|
||||
Reference in New Issue
Block a user