Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion 2009/ConfigurationFiles/AppxPackages.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
[
{
"AppxPackage": "Bing Search",
"VDIState": "Unchanged",
"URL": "https://apps.microsoft.com/detail/9nzbf4gt040c",
"Description": "Web Search from Microsoft Bing provides web results and answers in Windows Search"
},
{
"AppxPackage": "Clipchamp.Clipchamp",
"VDIState": "Unchanged",
Expand Down Expand Up @@ -27,7 +33,7 @@
"AppxPackage": "Microsoft.DesktopAppInstaller",
"VDIState": "Unchanged",
"URL": "https://apps.microsoft.com/detail/9NBLGGH4NNS1",
"Description": "Microsoft App Installer for Windows 10 makes sideloading Windows 10 apps easy"
"Description": "Microsoft App Installer for Windows 10 makes sideloading Windows apps easy"
},
{
"AppxPackage": "Microsoft.GamingApp",
Expand Down
182 changes: 182 additions & 0 deletions 2009/ConfigurationFiles/DefaultUserSettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,179 @@
[
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
"KeyName": "Start_IrisRecommendations",
"PropertyType": "DWord",
"PropertyValue": "0",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
"KeyName": "TaskbarMn",
"PropertyType": "DWord",
"PropertyValue": "0",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\CloudContent",
"KeyName": "DisableThirdPartySuggestions",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\CloudContent",
"KeyName": "DisableTailoredExperiencesWithDiagnosticData",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
"KeyName": "NoResolveSearch",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\Directory UI",
"KeyName": "QueryLimit",
"PropertyType": "DWord",
"PropertyValue": "1500",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer",
"KeyName": "NoWindowMinimizingShortcuts",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
"KeyName": "TaskbarNoNotification",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\CloudContent",
"KeyName": "DisableWindowsSpotlightFeatures",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
"KeyName": "NoThumbnailCache",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer",
"KeyName": "DisableSearchBoxSuggestions",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer",
"KeyName": "NoBalloonFeatureAdvertisements",
"PropertyType": "DWord",
"PropertyValue": "",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Control Panel\\International",
"KeyName": "TurnOffOfferTextPredictions",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer",
"KeyName": "DisableThumbsDBOnNetworkFolders",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\CurrentVersion\\PushNotifications",
"KeyName": "NoToastApplicationNotification",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\CurrentVersion\\PushNotifications",
"KeyName": "NoToastApplicationNotificationOnLockScreen",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\EdgeUI",
"KeyName": "DisableMFUTracking",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
"KeyName": "NoInstrumentation",
"PropertyType": "DWord",
"PropertyValue": "",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Edge\\Recommended",
"KeyName": "StartupBoostEnabled",
"PropertyType": "DWord",
"PropertyValue": "0",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\EdgeUpdate",
"KeyName": "UpdatesSuppressedDurationMin",
"PropertyType": "DWord",
"PropertyValue": "900",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\EdgeUpdate",
"KeyName": "UpdatesSuppressedStartHour",
"PropertyType": "DWord",
"PropertyValue": "4",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\EdgeUpdate",
"KeyName": "UpdatesSuppressedStartMin",
"PropertyType": "DWord",
"PropertyValue": "0",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
"KeyName": "NoSearchInternetInStartMenu",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer",
"KeyName": "NoRemoteDestinations",
"PropertyType": "DWord",
"PropertyValue": "1",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\SOFTWARE\\Policies\\Microsoft\\Windows\\CloudContent",
"KeyName": "ConfigureWindowsSpotlight",
"PropertyType": "DWord",
"PropertyValue": "2",
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
"KeyName": "ShellState",
Expand Down Expand Up @@ -236,5 +411,12 @@
"PropertyType": "DWORD",
"PropertyValue": 0,
"SetProperty": "True"
},
{
"HivePath": "HKLM:\\VDOT_TEMP\\Software\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsCopilot",
"KeyName": "TurnOffWindowsCopilot",
"PropertyType": "DWORD",
"PropertyValue": 1,
"SetProperty": "False"
}
]
53 changes: 16 additions & 37 deletions Windows_VDOT.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
[Cmdletbinding(DefaultParameterSetName="Default")]
Param (
# Parameter help description
[ArgumentCompleter( { Get-ChildItem $PSScriptRoot -Directory | Where-Object { $_.Name -ne 'LGPO' } | Select-Object -ExpandProperty Name } )]
[ArgumentCompleter( { Get-ChildItem $PSScriptRoot -Directory | Select-Object -ExpandProperty Name } )]
[System.String]$WindowsVersion = (Get-ItemProperty "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\").ReleaseId,

[ValidateSet('All','WindowsMediaPlayer','AppxPackages','ScheduledTasks','DefaultUserSettings','Autologgers','Services','NetworkOptimizations','LGPO','DiskCleanup')]
[ValidateSet('All','WindowsMediaPlayer','AppxPackages','ScheduledTasks','DefaultUserSettings','LocalPolicy','Autologgers','Services','NetworkOptimizations','DiskCleanup')]
[String[]]
$Optimizations,

Expand All @@ -51,22 +51,19 @@ Param (
- TITLE: Microsoft Windows Virtual Desktop Optimization Script
- AUTHORED BY: Robert M. Smith and Tim Muessig (Microsoft)
- AUTHORED DATE: 11/19/2019
- CONTRIBUTORS: Travis Roberts (2020), Jason Parker (2020)
- LAST UPDATED: 7/8/2022
- PURPOSE: To automatically apply settings referenced in the following white papers:
https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds_vdi-recommendations-1909
- CONTRIBUTORS: Travis Roberts (2020), Jason Parker (2020), @brentil (2024)
- LAST UPDATED: 6/11/2024
- PURPOSE: To automatically apply many optimization settings to and Windows device; VDI, AVD, standalone machine

- Important: Every setting in this script and input files are possible optimizations only,
and NOT recommendations or requirements. Please evaluate every setting for applicability
to your specific environment. These scripts have been tested on Hyper-V VMs, as well as Azure VMs...
including Windows 11.
including Windows 11 23H2.
Please test thoroughly in your environment before implementation

- DEPENDENCIES 1. On the target machine, run PowerShell elevated (as administrator)
2. Within PowerShell, set exectuion policy to enable the running of scripts.
Ex. Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
3. LGPO.EXE (available at https://www.microsoft.com/en-us/download/details.aspx?id=55319)
4. LGPO database files available in the respective folders (ex. \1909, or \2004)
5. This PowerShell script
6. The text input files containing all the apps, services, traces, etc. that you...
may be interested in disabling. Please review these input files to customize...
Expand All @@ -75,15 +72,12 @@ Param (
- REFERENCES:
https://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/remove-item?view=powershell-6
https://blogs.technet.microsoft.com/secguide/2016/01/21/lgpo-exe-local-group-policy-object-utility-v1-0/
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-service?view=powershell-6
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/remove-item?view=powershell-6
https://msdn.microsoft.com/en-us/library/cc422938.aspx
#>

<# Categories of cleanup items:
This script is dependent on the following:
LGPO Settings folder, applied with the LGPO.exe Microsoft app

The UWP app input file contains the list of almost all the UWP application packages that can be removed with PowerShell interactively.
The Store and a few others, such as Wallet, were left off intentionally. Though it is possible to remove the Store app,
Expand Down Expand Up @@ -123,7 +117,7 @@ BEGIN
New-ItemProperty -Path $KeyPath -Name $LastRun -Value $LastRunValue | Out-Null
}

$EventSources = @('VDOT', 'WindowsMediaPlayer', 'AppxPackages', 'ScheduledTasks', 'DefaultUserSettings', 'Autologgers', 'Services', 'NetworkOptimizations', 'LGPO', 'AdvancedOptimizations', 'DiskCleanup')
$EventSources = @('VDOT', 'WindowsMediaPlayer', 'AppxPackages', 'ScheduledTasks', 'DefaultUserSettings', 'Autologgers', 'Services', 'LocalPolicy', 'NetworkOptimizations', 'AdvancedOptimizations', 'DiskCleanup')
If (-not([System.Diagnostics.EventLog]::SourceExists("Virtual Desktop Optimization")))
{
# All VDOT main function Event ID's [1-9]
Expand Down Expand Up @@ -560,39 +554,39 @@ PROCESS {
# * change the "Root Certificates Update" policy.
# * change the "Enable Windows NTP Client" setting.
# * set the "Select when Quality Updates are received" policy
If ($Optimizations -contains "LGPO" -or $Optimizations -contains "All")
If ($Optimizations -EQ "All")
{
$LocalPolicyFilePath = ".\ConfigurationFiles\PolicyRegSettings.json"
If (Test-Path $LocalPolicyFilePath)
{
Write-EventLog -EventId 80 -Message "Local Group Policy Items" -LogName 'Virtual Desktop Optimization' -Source 'LGPO' -EntryType Information
Write-EventLog -EventId 80 -Message "Local Policy Items" -LogName 'Virtual Desktop Optimization' -Source 'LocalPolicy' -EntryType Information
Write-Host "[VDI Optimize] Local Group Policy Items" -ForegroundColor Cyan
$PolicyRegSettings = Get-Content $LocalPolicyFilePath | ConvertFrom-Json
If ($PolicyRegSettings.Count -gt 0)
{
Write-EventLog -EventId 80 -Message "Processing PolicyRegSettings Settings ($($PolicyRegSettings.Count) Hives)" -LogName 'Virtual Desktop Optimization' -Source 'LGPO' -EntryType Information
Write-EventLog -EventId 80 -Message "Processing PolicyRegSettings Settings ($($PolicyRegSettings.Count) Hives)" -LogName 'Virtual Desktop Optimization' -Source 'LocalPolicy' -EntryType Information
Write-Verbose "Processing PolicyRegSettings Settings ($($PolicyRegSettings.Count) Hives)"
Foreach ($Key in $PolicyRegSettings)
{
If ($Key.VDIState -eq 'Enabled')
{
If (Get-ItemProperty -Path $Key.RegItemPath -Name $Key.RegItemValueName -ErrorAction SilentlyContinue)
{
Write-EventLog -EventId 80 -Message "Found key, $($Key.RegItemPath) Name $($Key.RegItemValueName) Value $($Key.RegItemValue)" -LogName 'Virtual Desktop Optimization' -Source 'LGPO' -EntryType Information
Write-EventLog -EventId 80 -Message "Found key, $($Key.RegItemPath) Name $($Key.RegItemValueName) Value $($Key.RegItemValue)" -LogName 'Virtual Desktop Optimization' -Source 'LocalPolicy' -EntryType Information
Write-Verbose "Found key, $($Key.RegItemPath) Name $($Key.RegItemValueName) Value $($Key.RegItemValue)"
Set-ItemProperty -Path $Key.RegItemPath -Name $Key.RegItemValueName -Value $Key.RegItemValue -Force
}
Else
{
If (Test-path $Key.RegItemPath)
{
Write-EventLog -EventId 80 -Message "Path found, creating new property -Path $($Key.RegItemPath) -Name $($Key.RegItemValueName) -PropertyType $($Key.RegItemValueType) -Value $($Key.RegItemValue)" -LogName 'Virtual Desktop Optimization' -Source 'LGPO' -EntryType Information
Write-EventLog -EventId 80 -Message "Path found, creating new property -Path $($Key.RegItemPath) -Name $($Key.RegItemValueName) -PropertyType $($Key.RegItemValueType) -Value $($Key.RegItemValue)" -LogName 'Virtual Desktop Optimization' -Source 'LocalPolicy' -EntryType Information
Write-Verbose "Path found, creating new property -Path $($Key.RegItemPath) Name $($Key.RegItemValueName) PropertyType $($Key.RegItemValueType) Value $($Key.RegItemValue)"
New-ItemProperty -Path $Key.RegItemPath -Name $Key.RegItemValueName -PropertyType $Key.RegItemValueType -Value $Key.RegItemValue -Force | Out-Null
}
Else
{
Write-EventLog -EventId 80 -Message "Error: Creating Name $($Key.RegItemValueName), Value $($Key.RegItemValue) and Path $($Key.RegItemPath)" -LogName 'Virtual Desktop Optimization' -Source 'LGPO' -EntryType Information
Write-EventLog -EventId 80 -Message "Error: Creating Name $($Key.RegItemValueName), Value $($Key.RegItemValue) and Path $($Key.RegItemPath)" -LogName 'Virtual Desktop Optimization' -Source 'LocalPolicy' -EntryType Information
Write-Verbose "Error: Creating Name $($Key.RegItemValueName), Value $($Key.RegItemValue) and Path $($Key.RegItemPath)"
New-Item -Path $Key.RegItemPath -Force | New-ItemProperty -Name $Key.RegItemValueName -PropertyType $Key.RegItemValueType -Value $Key.RegItemValue -Force | Out-Null
}
Expand All @@ -603,26 +597,10 @@ PROCESS {
}
Else
{
Write-EventLog -EventId 80 -Message "No LGPO Settings Found!" -LogName 'Virtual Desktop Optimization' -Source 'LGPO' -EntryType Warning
Write-Warning "No LGPO Settings found"
Write-EventLog -EventId 80 -Message "No LocalPolicy Settings Found!" -LogName 'Virtual Desktop Optimization' -Source 'LocalPolicy' -EntryType Warning
Write-Warning "No LocalPolicy Settings found"
}
}
# Removing support for LGPO legacy tool
#Else
#{
# If (Test-Path (Join-Path $PSScriptRoot "LGPO\LGPO.exe"))
# {
# Write-EventLog -EventId 80 -Message "[VDI Optimize] Import Local Group Policy Items" -LogName 'Virtual Desktop Optimization' -Source 'LGPO' -EntryType Information
# Write-Host "[VDI Optimize] Import Local Group Policy Items" -ForegroundColor Cyan
# Write-Verbose "Importing Local Group Policy Items"
# Start-Process (Join-Path $PSScriptRoot "LGPO\LGPO.exe") -ArgumentList "/g .\LGPO" -Wait
# }
# Else
# {
# Write-EventLog -EventId 80 -Message "File not found $PSScriptRoot\LGPO\LGPO.exe" -LogName 'Virtual Desktop Optimization' -Source 'LGPO' -EntryType Warning
# Write-Warning "File not found $PSScriptRoot\LGPO\LGPO.exe"
# }
#}
}
#endregion

Expand Down Expand Up @@ -756,6 +734,7 @@ PROCESS {
Write-EventLog -EventId 90 -Message "Clearing BranchCache cache" -LogName 'Virtual Desktop Optimization' -Source 'DiskCleanup' -EntryType Information
Write-Host "Clearing BranchCache cache"
Clear-BCCache -Force -ErrorAction SilentlyContinue

} #endregion

Set-Location $CurrentLocation
Expand Down