Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 1 #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 74 additions & 21 deletions stripwindows.ps1
Original file line number Diff line number Diff line change
@@ -1,21 +1,74 @@
Set-Service -StartupType Disabled -Name "DiagTrack"
Set-Service -StartupType Disabled -Name "DusmSvc"
Set-Service -StartupType Disabled -Name "LanmanWorkstation"
Set-Service -StartupType Disabled -Name "WSearch"
Set-Service -StartupType Disabled -Name "WpnService"
Set-Service -StartupType Disabled -Name "LicenseManager"
Set-Service -StartupType Disabled -Name "EventLog"
Set-Service -StartupType Disabled -Name "TokenBroker"
Set-Service -StartupType Disabled -Name "UsoSvc"
Set-Service -StartupType Disabled -Name "TabletInputService"
Set-Service -StartupType Disabled -Name "DPS"
Set-Service -StartupType Disabled -Name "iphlpsvc"
Set-Service -StartupType Disabled -Name "NcbService"
Set-Service -StartupType Disabled -Name "Spooler"
Set-Service -StartupType Disabled -Name "PcaSvc"
Set-Service -StartupType Disabled -Name "LanmanServer"
Set-Service -StartupType Disabled -Name "SysMain"
Set-Service -StartupType Disabled -Name "lmhosts"
Set-Service -StartupType Disabled -Name "Themes"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "Shell" -Value "C:\Program Files (x86)\Overwatch\_retail_\Overwatch.exe"
shutdown /r /t 0
<#
# File: Win 11 Optimizer
# Created Date: Tuesday, October 18th 2022, 6:35:19 pm
# HISTORY:
# Date By Comments
# ---------- --- ----------------------------------------------------------
# 2022-10-19 C.V. Added further error handling measures
# 2022-10-18 C.V. Created
#>

# Set variables

$services = @(
"DiagTrack",
"DusmSvc",
"LanmanWorkstation",
"WSearch",
"WpnService",
"LicenseManager",
"EventLog",
"TokenBroker",
"UsoSvc",
"TabletInputService",
"DPS",
"iphlpsvc",
"NcbService",
"Spooler",
"PcaSvc",
"LanmanServer",
"SysMain",
"lmhosts",
"Themes"
)

$action = Read-Host 'Please verify which option you wish to do. Enable or Disable?'
if ($action -like '*enable*' ) {
$action = 'Enabled'
} elseif ($action -like '*disable*') {
$action = 'Disabled'
}

# Start actions
foreach ($service in $services) {
Set-Service -StartupType $action -Name $service
Write-Host $service 'has been' $action
}

Write-Host 'Action confirmed: '$action

try {
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon -Name Shell -Value C:\Program Files (x86)\Overwatch\_retail_\Overwatch.exe
} catch {
Write-Host 'Unable to set item property for Overwatch.exe. Please enter path of Overwatch.exe file (ex. C:\:\Program Files (x86)\Overwatch\_retail_\Overwatch.exe)'
$path = Read-Host 'Full Directory Path: '

}

try {
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon -Name Shell -Value $path
} catch {
Write-Host 'Unable to set Item Property. Critical Error'
return 1
end
}

$action2 = Read-Host 'Are you prepared to shut down?'

if ($action2 -like '*yes*') {
Write-Host 'Rebooting now...'
shutdown /r /t 5
} elseif ($action2 -like '*no*') {
Write-Host 'Please reboot manually then.'
}