added Powershellscript für Windows

This commit is contained in:
Pakobbix 2023-03-02 12:01:15 +00:00
parent 194584d951
commit 2f09a6e784

28
WireWin.ps1 Normal file
View File

@ -0,0 +1,28 @@
# Ü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