-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRun-All-Work-Scriptsv1.2-RMM.ps1
More file actions
164 lines (141 loc) · 5.64 KB
/
Copy pathRun-All-Work-Scriptsv1.2-RMM.ps1
File metadata and controls
164 lines (141 loc) · 5.64 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#Requires -RunAsAdministrator
<#
.SYNOPSIS
Non-interactive RMM runner for workScripts (NinjaOne-friendly).
.DESCRIPTION
Runs the main setup tasks without any interactive prompts. This script does NOT
download anything from RMM. It executes the GitHub-hosted scripts in-memory and
explicitly skips C:\Archive installs (use a separate part 2).
It also enables the built-in Administrator account and sets the password provided
via -AdministratorPassword.
.NOTES
Use in RMM with parameters; avoid logging sensitive values.
#>
param(
[string]$AdministratorPassword,
[string]$AdministratorPasswordBase64,
[string]$DomainsAllowedToLogin = "ashleyvance.com",
[switch]$SkipSetup,
[switch]$SkipDriveClone,
[switch]$SkipEgnyteInstall,
[switch]$RunRaphireDebloat,
[switch]$RunEngineeringDebloat,
[switch]$ConfirmEngineeringDebloat
)
Write-Host "===========================================================" -ForegroundColor Cyan
Write-Host " STARTING MASTER WORK SCRIPT (RMM MODE)"
Write-Host "===========================================================" -ForegroundColor Cyan
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Error "[ERROR] This script requires Administrator privileges."
exit 1
}
if (-not [string]::IsNullOrWhiteSpace($AdministratorPasswordBase64)) {
try {
$AdministratorPassword = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($AdministratorPasswordBase64))
}
catch {
Write-Error "[ERROR] AdministratorPasswordBase64 is invalid."
exit 1
}
}
if ([string]::IsNullOrWhiteSpace($AdministratorPassword)) {
Write-Error "[ERROR] Provide -AdministratorPassword or -AdministratorPasswordBase64."
exit 1
}
try {
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
}
catch {
Write-Error "[ERROR] Failed to set execution policy."
exit 1
}
function Set-BuiltinAdminPassword {
try {
$enable = Start-Process -FilePath "net" -ArgumentList @("user", "administrator", "/active:yes") -NoNewWindow -Wait -PassThru
if ($enable.ExitCode -ne 0) {
Write-Error "[ERROR] Failed to enable Administrator account."
exit 1
}
$setPwd = Start-Process -FilePath "net" -ArgumentList @("user", "administrator", $AdministratorPassword) -NoNewWindow -Wait -PassThru
if ($setPwd.ExitCode -ne 0) {
Write-Error "[ERROR] Failed to set Administrator password."
exit 1
}
Write-Host "[OK] Administrator account enabled and password updated." -ForegroundColor Green
}
catch {
Write-Error "[ERROR] Failed to set Administrator password: $($_.Exception.Message)"
exit 1
}
}
if (-not $SkipSetup) {
Set-BuiltinAdminPassword
Write-Host "[STEP] Windows settings script..." -ForegroundColor Cyan
try {
& ([scriptblock]::Create((irm "https://raw.githubusercontent.com/JevonThompsonx/workScripts/main/Configuration/setup_script_windows_settings1_3.ps1"))) -NoPause
}
catch {
Write-Error "[ERROR] Windows settings script failed."
}
Write-Host "[STEP] Google Credential Provider settings..." -ForegroundColor Cyan
try {
& ([scriptblock]::Create((irm "https://raw.githubusercontent.com/JevonThompsonx/workScripts/main/Accounts/AllowGoogleCred.ps1"))) -DomainsAllowedToLogin $DomainsAllowedToLogin
}
catch {
Write-Error "[ERROR] Google Credential Provider script failed."
}
}
else {
Write-Host "[SKIP] Setup steps skipped." -ForegroundColor Yellow
}
if (-not $SkipDriveClone) {
Write-Host "[STEP] Clone Egnyte drive mapping scripts..." -ForegroundColor Cyan
try {
& ([scriptblock]::Create((irm "https://raw.githubusercontent.com/JevonThompsonx/workScripts/main/Networking/cloneDrives.ps1")))
}
catch {
Write-Error "[ERROR] Drive clone script failed."
}
}
else {
Write-Host "[SKIP] Drive clone skipped." -ForegroundColor Yellow
}
if (-not $SkipEgnyteInstall) {
Write-Host "[STEP] Egnyte install/update..." -ForegroundColor Cyan
try {
& ([scriptblock]::Create((irm "https://raw.githubusercontent.com/JevonThompsonx/workScripts/main/Install/updatingSoftware/Update-Egnyte-v1.5.ps1"))) -NoPause
}
catch {
Write-Error "[ERROR] Egnyte update script failed."
}
}
else {
Write-Host "[SKIP] Egnyte install/update skipped." -ForegroundColor Yellow
}
Write-Host "[SKIP] C:\Archive installs skipped by design." -ForegroundColor Yellow
if ($RunEngineeringDebloat) {
Write-Host "[STEP] Engineering debloat..." -ForegroundColor Cyan
if ($ConfirmEngineeringDebloat) {
try {
& ([scriptblock]::Create((irm "https://raw.githubusercontent.com/JevonThompsonx/workScripts/main/Maintenance/engineeringDebloat.ps1"))) -NonInteractive -Mode All -ConfirmRemoval -NoPause
}
catch {
Write-Error "[ERROR] Engineering debloat failed."
}
}
else {
Write-Host "[SKIP] Engineering debloat not confirmed. Set -ConfirmEngineeringDebloat to proceed." -ForegroundColor Yellow
}
}
elseif ($RunRaphireDebloat) {
Write-Host "[STEP] Raphire debloat..." -ForegroundColor Cyan
try {
& ([scriptblock]::Create((irm "https://debloat.raphi.re/")))
}
catch {
Write-Error "[ERROR] Raphire debloat failed."
}
}
Write-Host "===========================================================" -ForegroundColor Cyan
Write-Host " RMM SCRIPT FINISHED"
Write-Host "===========================================================" -ForegroundColor Cyan