-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathctrld-install.ps1
More file actions
50 lines (41 loc) · 2.13 KB
/
ctrld-install.ps1
File metadata and controls
50 lines (41 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Sprawdzenie, czy skrypt działa jako administrator
$currentUser = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if (-not $currentUser.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Add-Type -AssemblyName PresentationFramework
$message = "Skrypt wymaga uprawnień administratora. Czy chcesz uruchomić ponownie jako administrator?"
$caption = "Wymagane uprawnienia administratora"
$buttons = [System.Windows.MessageBoxButton]::YesNo
$result = [System.Windows.MessageBox]::Show($message, $caption, $buttons, [System.Windows.MessageBoxImage]::Question)
if ($result -eq [System.Windows.MessageBoxResult]::Yes) {
Start-Process -FilePath powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
}
exit
}
# Jeśli jest adminem, to utwórz folder
if (-not (Test-Path 'C:\ControlD')) {
New-Item -ItemType Directory -Path 'C:\ControlD' -Force | Out-Null
}
# Ustawienie uprawnień – korzystamy z SID dla pewności
icacls 'C:\ControlD' /grant '*S-1-5-32-544':(OI)(CI)F '*S-1-5-32-545':(OI)(CI)M /T | Out-Null
# Pobierz i zapisz skrypt instalacyjny
(Invoke-WebRequest -Uri 'https://api.controld.com/dl/ps1' -UseBasicParsing).Content |
Set-Content "$env:TEMP\ctrld_install.ps1"
# Uruchom skrypt
Invoke-Expression "& '$env:TEMP\ctrld_install.ps1' 'x-oisd' 'forced'"
##############################################################################################
# #
# Zamień x-oisd na inny wariant z https://docs.controld.com/docs/free-dns #
# Przykłady: #
# #
# p0 #
# p1 #
# p3 #
# x-hagezi-light #
# x-hagezi-normal #
# x-hagezi-pro #
# x-hagezi-proplus #
# x-hagezi-ultimate #
# x-hagezi-tif #
# x-adguard #
# #
##############################################################################################