Skip to content

Instantly share code, notes, and snippets.

@jamesadjinwa
Last active November 26, 2021 10:15
Show Gist options
  • Save jamesadjinwa/860edc7a534a2e46065016ca435df22b to your computer and use it in GitHub Desktop.
Save jamesadjinwa/860edc7a534a2e46065016ca435df22b to your computer and use it in GitHub Desktop.
Boxstarter package for Windows 10 configuration
### OS optimization
## Remove default apps
#
Write-Host "Uninstall some applications that come with Windows out of the box" -ForegroundColor "Yellow"
function removeApp {
Param ([string]$appName)
Write-Output "Trying to remove $appName"
Get-AppxPackage $appName -AllUsers | Remove-AppxPackage
Get-AppXProvisionedPackage -Online | Where DisplayName -like $appName | Remove-AppxProvisionedPackage -Online
}
$applicationList = @(
"Microsoft.BingFinance"
"Microsoft.3DBuilder"
"Microsoft.BingFinance"
"Microsoft.BingNews"
"Microsoft.BingSports"
"Microsoft.BingWeather"
"Microsoft.CommsPhone"
"Microsoft.Getstarted"
"Microsoft.WindowsMaps"
"*MarchofEmpires*"
"Microsoft.GetHelp"
"Microsoft.Messaging"
"*Minecraft*"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.OneConnect"
"Microsoft.WindowsPhone"
#"Microsoft.WindowsSoundRecorder"
"*Solitaire*"
#"Microsoft.MicrosoftStickyNotes"
"Microsoft.Office.Sway"
"Microsoft.XboxApp"
#"Microsoft.XboxIdentityProvider"
"Microsoft.ZuneMusic"
"Microsoft.ZuneVideo"
"Microsoft.NetworkSpeedTest"
"Microsoft.FreshPaint"
"Microsoft.Print3D"
"*Autodesk*"
"*BubbleWitch*"
"king.com*"
"G5*"
"*Dell*"
"*Facebook*"
"*Keeper*"
"*Netflix*"
"*Twitter*"
"*Plex*"
"*.Duolingo-LearnLanguagesforFree"
"*.EclipseManager"
"ActiproSoftwareLLC.562882FEEB491" # Code Writer
"*.AdobePhotoshopExpress"
);
foreach ($app in $applicationList) {
removeApp $app
}
## Find and start the WinRM service.
Write-Verbose "Verifying WinRM service."
If (!(Get-Service "WinRM"))
{
Write-Verbose "Unable to find the WinRM service."
Throw "Unable to find the WinRM service."
}
ElseIf ((Get-Service "WinRM").Status -ne "Running")
{
# Write-Verbose "Setting WinRM service to start automatically on boot."
# Set-Service -Name "WinRM" -StartupType Automatic
# Write-Verbose "Set WinRM service to start automatically on boot."
Write-Verbose "Starting WinRM service."
Start-Service -Name "WinRM" -ErrorAction Stop
Write-Verbose "Started WinRM service."
}
# WinRM should be running; check that we have a PS session config.
If (!(Get-PSSessionConfiguration -Verbose:$false) -or (!(Get-ChildItem WSMan:\localhost\Listener)))
{
If ($SkipNetworkProfileCheck) {
Write-Verbose "Enabling PS Remoting without checking Network profile."
Enable-PSRemoting -SkipNetworkProfileCheck -Force -ErrorAction Stop
Write-Verbose "Enabled PS Remoting without checking Network profile."
}
Else {
Write-Verbose "Enabling PS Remoting."
Enable-PSRemoting -Force -ErrorAction Stop
Write-Verbose "Enabled PS Remoting."
}
}
Else
{
Write-Verbose "PS Remoting is already enabled."
}
## Disable unwanted Windows services. If you do not want to disable
$services = @(
"diagnosticshub.standardcollector.service" # Microsoft (R) Diagnostics Hub Standard Collector Service
"DiagTrack" # Diagnostics Tracking Service
"dmwappushservice" # WAP Push Message Routing Service
"HomeGroupListener" # HomeGroup Listener
"HomeGroupProvider" # HomeGroup Provider
"lfsvc" # Geolocation Service
"MapsBroker" # Downloaded Maps Manager
"NetTcpPortSharing" # Net.Tcp Port Sharing Service
"RemoteAccess" # Routing and Remote Access
"RemoteRegistry" # Remote Registry
"SharedAccess" # Internet Connection Sharing (ICS)
"TrkWks" # Distributed Link Tracking Client
"WbioSrvc" # Windows Biometric Service
#"WlanSvc" # WLAN AutoConfig
"WMPNetworkSvc" # Windows Media Player Network Sharing Service
"wscsvc" # Windows Security Center Service
#"WSearch" # Windows Search
"XblAuthManager" # Xbox Live Auth Manager
"XblGameSave" # Xbox Live Game Save Service
"XboxNetApiSvc" # Xbox Live Networking Service
# Services which cannot be disabled
#"WdNisSvc"
);
foreach ($service in $services) {
echo "Trying to disable $service"
Get-Service -Name $service | Set-Service -StartupType Disabled
}
## Install critical security updates
#
Enable-UAC
Enable-MicrosoftUpdate
Update-Help
Install-WindowsUpdate -acceptEula
Clear-History
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment