@@ -7,21 +7,13 @@ Invoke a single command from this script; default is to run all
77
88. PARAMETER ListCommands
99Show a list of all available commands
10-
11- . PARAMETER DisableCortana
12- Disable Cortana advanced search support which uses excessive CPU.
13-
14- . PARAMETER DisableOneDrive
15- Remove OneDrive support; default is to keep OneDrive.
1610#>
1711
1812# CmdletBinding adds -Verbose functionality, SupportsShouldProcess adds -WhatIf
1913[CmdletBinding (SupportsShouldProcess = $true )]
2014
2115param (
2216 [parameter (Position = 0 )] $command ,
23- [switch ] $DisableOneDrive ,
24- [switch ] $DisableCortana ,
2517 [switch ] $ListCommands
2618)
2719
@@ -610,8 +602,8 @@ Begin
610602 if (Test-Path $0 ) { Set-ItemProperty $0 - Name ' TaskbarDa' - Type DWord - Value 0 }
611603 }
612604
613- # DisableCortana
614- Write-Verbose " Disabling Cortana..."
605+ # Limit Cortana
606+ Write-Verbose " Limiting Cortana..."
615607 $0 = ' HKCU:\SOFTWARE\Microsoft\Personalization\Settings'
616608 If (! (Test-Path $0 )) { New-Item - Path $0 - Force | Out-Null }
617609 Set-ItemProperty $0 - Name ' AcceptedPrivacyPolicy' - Type DWord - Value 0
@@ -622,25 +614,31 @@ Begin
622614 $0 = ' HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore'
623615 if (! (Test-Path $0 )) { New-Item - Path $0 - Force | Out-Null }
624616 Set-ItemProperty $0 - Name ' HarvestContacts' - Type DWord - Value 0
617+
618+ # enable Hibernate option
619+ Write-Verbose ' enabling hibernate option'
620+ powercfg / h on
621+ }
622+
623+
624+ function DisableCortana
625+ {
626+ [System.ComponentModel.Description (' Disable Cortana search preserving excessive CPU' )]
627+ [CmdletBinding (HelpURI = ' cmd' )] param ()
628+
629+ Write-Verbose " Disabling Cortana..."
625630 $0 = ' HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
626631 if (! (Test-Path $0 )) { New-Item - Path $0 - Force | Out-Null }
627632 Set-ItemProperty $0 - Name ' AllowCortana' - Type DWord - Value 0
628633
629634 # Block Cortana SearchUI (uses excessive CPU)
630- if ($DisableCortana )
635+ $0 = ' C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy'
636+ if (Test-Path " $0 \SearchUI.exe" )
631637 {
632- $0 = ' C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy'
633- if (Test-Path " $0 \SearchUI.exe" )
634- {
635- Stop-Process - Name ' SearchUI' ;
636- Set-ItemOwner " $0 \SearchUI.exe"
637- Rename-Item " $0 \SearchUI.exe" " $0 \SearchUI.exe_BLOCK"
638- }
638+ Stop-Process - Name ' SearchUI' ;
639+ Set-ItemOwner " $0 \SearchUI.exe"
640+ Rename-Item " $0 \SearchUI.exe" " $0 \SearchUI.exe_BLOCK"
639641 }
640-
641- # enable Hibernate option
642- Write-Verbose ' enabling hibernate option'
643- powercfg / h on
644642 }
645643
646644
@@ -733,10 +731,6 @@ Process
733731 SecurePagefile
734732 ScheduleTempCleanup
735733
736- if ($DisableOneDrive ) {
737- DisableOneDrive
738- }
739-
740734 # requires powershell profile scripts
741735 DisableZipFolders
742736
0 commit comments