-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.ps1
More file actions
50 lines (45 loc) · 2.01 KB
/
bootstrap.ps1
File metadata and controls
50 lines (45 loc) · 2.01 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
# SentinelOne AIO Bootstrap (Windows-only)
# Author: quippy-dev
# Minimal launcher for environments where pasting a small script into RMM/PSA tools is easier than transferring the full S1-AIO.ps1.
$Mode = 'Install' # Valid: Purge/Install/Rollback/Clean/Kill/CleanTemp/OnlyMSI
$SiteToken = 'CHANGE_ME_IF_FRESH_INSTALL_OR_ROLLBACK'
$ConsoleUrl = 'https://<agent-configured-console>/'
$ApiConsoleUrl = $ConsoleUrl # Set this if your API token belongs to a different (active) tenant than the console the agent trusts
$AnyTarget = 0 # Set to 1 to bypass management URL checks during purge (use with care)
$Arguments = @(
'-VerboseOutput','-SkipCleanup',
'-Mode',$Mode,'-ConsoleUrl',$ConsoleUrl,'-ApiConsoleUrl',$ApiConsoleUrl,'-AnyTarget',$AnyTarget,'-CustomerSiteToken',$SiteToken,
'-InstallTimeoutSec',600,'-RollbackTimeoutSec',600,
'-Dynamic'
# Uncomment as needed:
# '-UnattendedMode',
# '-ShowInstaller',
# '-SkipStateless',
# '-WithObliterator'
)
# Replace with mirrors you control that host AIO.ps1
$Hosts = @(
'https://mirror-primary.example.com/installers',
'https://mirror-backup.example.com/installers',
'https://mirror-edge.example.com/installers'
)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
try {
$MgmtHost = ($ConsoleUrl -replace '^https?://','')
[void][System.Net.Dns]::GetHostEntry($MgmtHost.Split('/')[0])
$null = (New-Object Net.WebClient).DownloadString($ConsoleUrl)
} catch {
Write-Warning ("Connection to management URL failed. Check firewalls and TLS settings. " +
($_.Exception.GetBaseException().Message))
}
foreach($Url in $Hosts){
try {
$Host = $Url.Split('/')[2]
[void][System.Net.Dns]::GetHostEntry($Host)
$Src = "$Url/S1-AIO.ps1?v=$(Get-Date -UFormat %s)"
Write-Host "Executing $Mode via $Host"
Invoke-Expression ("& { $((New-Object Net.WebClient).DownloadString($Src)) } " + ($Arguments -join ' ')); break
} catch {
Write-Warning ($_.Exception.GetBaseException().Message + " (${Url})")
}
}