28 lines
1.1 KiB
PowerShell
28 lines
1.1 KiB
PowerShell
# Überprüfe ob powershellscripte ausgeführt werden dürfen
|
|
if ((Get-ExecutionPolicy) -eq "Restricted") {
|
|
Set-ExecutionPolicy RemoteSigned
|
|
}
|
|
|
|
# Überprüfe ob chocolatey installiert ist
|
|
if (!(Get-Command choco.exe -ErrorAction SilentlyContinue)) {
|
|
# Install Chocolatey
|
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
|
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
|
}
|
|
|
|
# Installiere Wireguard mit chocolatey
|
|
choco install wireguard -y
|
|
|
|
New-Item -ItemType File -Path "C:\Program Files\WireGuard\Data\Configurations\wg0.conf"
|
|
|
|
# Eingabe für die Wireguard Configuration:
|
|
$config = Read-Host "Gebe hier die Wireguard Konfiguration ein: (Zweimal auf Enter drücken zum bestätigen)"
|
|
|
|
# Füge die Konfiguration an die wg0.conf an
|
|
Add-Content -Path "C:\Program Files\WireGuard\Data\Configurations\wg0.conf" -Value $config
|
|
|
|
reg add HKLM\Software\WireGuard /v LimitedOperatorUI /t REG_DWORD /d 1 /f
|
|
|
|
$usertoadd = Read-Host "Gebe den Nutzernamen ein: (Zweimal auf Enter drücken zum bestätigen)"
|
|
|
|
Add-LocalGroupMember -Group 'Netzwerkkonfigurations-Operatoren' -Member '$usertoadd' -Verbose |