-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathSet-NTPServerUp.ps1
27 lines (22 loc) · 1.41 KB
/
Set-NTPServerUp.ps1
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
$Logo = @"
╔═══╗░░╔╗░░░░░░░░░░░░╔═══╗░░░░░
║╔═╗║░░║║░░░░░░░░░░░░║╔═╗║░░░░░
║║░║╠══╣╚═╦══╦═╦═╗╔══╣╚═╝╠═╦══╗
║║░║║══╣╔╗║╔╗║╔╣╔╗╣║═╣╔══╣╔╣╔╗║
║╚═╝╠══║╚╝║╚╝║║║║║║║═╣║░░║║║╚╝║
╚═══╩══╩══╩══╩╝╚╝╚╩══╩╝░░╚╝╚══╝
===============================
If you can't beat `em tech `em!
===============================
https://osbornepro.com
EMAIL: [email protected]
"@
Write-Output "$Logo"
$NTPReg = "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time"
Write-Output "[*] Enabling UDP port 123 on firewall for NTP connections"
New-NetFirewallRule -DisplayName "Allow NTP" -Profile @('Domain','Private','Public') -Direction Inbound -Action Allow -Protocol UDP -LocalPort 123 -Description "Allow UPD port 123 traffic for NTP connections"
Write-Output "[*] Enabling NTP Server"
Set-ItemProperty -Path "$NTPReg\TimeProviders\NTPServer" -Name "Enabled" -Value 1 -Force -ErrorAction SilentlyContinue
Write-Output "[*] Enabling NTP announcements"
Set-ItemProperty -Path "$NTPReg\Config" -Name "AnnounceFlags" -Value 5 -Force -ErrorAction SilentlyContinue
Restart-Service -Name W32Time -Force