Windows 10/Deployment Batch: Difference between revisions

From Wiki
(Die Seite wurde neu angelegt: „* Disable Cortana <pre> $path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" IF(!(Test-Path -Path $path)) { New-Item -Path "HKLM:\SOF…“)
 
mNo edit summary
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Hibernation ==
* disable
<pre>
powercfg.exe /hibernate off
</pre>
* enable
<pre>
powercfg.exe /hibernate on
</pre>
== PowerShell ==
* disable/enable powershell restrictions
<pre>
set-executionpolicy unrestricted
set-executionpolicy restricted
</pre>
== Taskbar ==
* Disable Cortana  
* Disable Cortana  
<pre>
<pre>
Line 5: Line 25:
     New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "Windows Search"  
     New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "Windows Search"  
}   
}   
Set-ItemProperty -Path $path -Name "AllowCortana" -Value 1  
Set-ItemProperty -Path $path -Name "AllowCortana" -Value 0  
#Restart Explorer to change it immediately     
#Restart Explorer to change it immediately     
Stop-Process -name explorer
Stop-Process -name explorer
</pre>
</pre>
* Disable Searchbox (not working)
<pre>
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search"
Set-ItemProperty -Path $path -Name "SearchboxTaskbar" -Value 0 
</pre>
* Disable Task View icon (not working)
<pre>
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer"
New-Item -Path $path -Name "MultiTaskingView"
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\MultiTaskingView"
New-Item -Path $path -Name "AllUpView"
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\MultiTaskingView\AllUpView"
New-ItemProperty -Path $path -Name "Enabled" -PropertyType DWord -Value "0"
</pre>
* Uninstall OneDrive
<pre>
taskkill /f /im OneDrive.exe
%SystemRoot%\System32\OneDriveSetup.exe /uninstall
%SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall
</pre>
* Show all tray icons
<pre>
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer"   
Set-ItemProperty -Path $path -Name "EnableAutoTray" -Value 0 
</pre>
* Disable Intel HD Graphics tray icon + shortcuts
<pre>
$path = "HKCU:\Software\Intel\Display\igfxcui\igfxtray\TrayIcon"
Set-ItemProperty -Path $path -Name "ShowTrayIcon" -Value 0 
$path = "HKCU:\Software\Intel\Display\igfxcui\HotKeys"
Set-ItemProperty -Path $path -Name "Enable" -Value 0 
</pre>
== Remove crap ==
* Cleanup Manager (untested)
<pre>
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\*' -Name StateFlags0001 -ErrorAction SilentlyContinue | Remove-ItemProperty -Name StateFlags0001 -ErrorAction SilentlyContinue
New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Update Cleanup' -Name StateFlags0001 -Value 2 -PropertyType DWord
New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files' -Name StateFlags0001 -Value 2 -PropertyType DWord
Start-Process -FilePath CleanMgr.exe -ArgumentList '/sagerun:1' -WindowStyle Hidden -Wait
Get-Process -Name cleanmgr,dismhost -ErrorAction SilentlyContinue | Wait-Process
$UpdateCleanupSuccessful = $false
if (Test-Path $env:SystemRoot\Logs\CBS\DeepClean.log) {
    $UpdateCleanupSuccessful = Select-String -Path $env:SystemRoot\Logs\CBS\DeepClean.log -Pattern 'Total size of superseded packages:' -Quiet
}
if ($UpdateCleanupSuccessful) {
    SHUTDOWN.EXE /r /f /t 0 /c 'Rebooting to complete CleanMgr.exe Update Cleanup....'
}
</pre>
[[Category:Windows 10]]

Latest revision as of 11:36, 18 January 2021

Hibernation

  • disable
powercfg.exe /hibernate off
  • enable
powercfg.exe /hibernate on

PowerShell

  • disable/enable powershell restrictions
set-executionpolicy unrestricted
set-executionpolicy restricted

Taskbar

  • Disable Cortana
$path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"     
IF(!(Test-Path -Path $path)) {  
    New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "Windows Search" 
}  
Set-ItemProperty -Path $path -Name "AllowCortana" -Value 0  
#Restart Explorer to change it immediately     
Stop-Process -name explorer


  • Disable Searchbox (not working)
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search"
Set-ItemProperty -Path $path -Name "SearchboxTaskbar" -Value 0  


  • Disable Task View icon (not working)
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer"
New-Item -Path $path -Name "MultiTaskingView"
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\MultiTaskingView"
New-Item -Path $path -Name "AllUpView"
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\MultiTaskingView\AllUpView"
New-ItemProperty -Path $path -Name "Enabled" -PropertyType DWord -Value "0"


  • Uninstall OneDrive
taskkill /f /im OneDrive.exe
%SystemRoot%\System32\OneDriveSetup.exe /uninstall
%SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall


  • Show all tray icons
$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer"     
Set-ItemProperty -Path $path -Name "EnableAutoTray" -Value 0  
  • Disable Intel HD Graphics tray icon + shortcuts
$path = "HKCU:\Software\Intel\Display\igfxcui\igfxtray\TrayIcon"
Set-ItemProperty -Path $path -Name "ShowTrayIcon" -Value 0  

$path = "HKCU:\Software\Intel\Display\igfxcui\HotKeys"
Set-ItemProperty -Path $path -Name "Enable" -Value 0  

Remove crap

  • Cleanup Manager (untested)
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\*' -Name StateFlags0001 -ErrorAction SilentlyContinue | Remove-ItemProperty -Name StateFlags0001 -ErrorAction SilentlyContinue

New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Update Cleanup' -Name StateFlags0001 -Value 2 -PropertyType DWord
New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files' -Name StateFlags0001 -Value 2 -PropertyType DWord

Start-Process -FilePath CleanMgr.exe -ArgumentList '/sagerun:1' -WindowStyle Hidden -Wait

Get-Process -Name cleanmgr,dismhost -ErrorAction SilentlyContinue | Wait-Process

$UpdateCleanupSuccessful = $false
if (Test-Path $env:SystemRoot\Logs\CBS\DeepClean.log) {
    $UpdateCleanupSuccessful = Select-String -Path $env:SystemRoot\Logs\CBS\DeepClean.log -Pattern 'Total size of superseded packages:' -Quiet
}

if ($UpdateCleanupSuccessful) {
    SHUTDOWN.EXE /r /f /t 0 /c 'Rebooting to complete CleanMgr.exe Update Cleanup....'
}