Minimize memory usage in win10

Remove all apps,

1
#Get-AppxPackage -AllUsers | Remove-AppxPackage

To restore,

dism.exe /online /cleanup-image /scanhealth
dism.exe /online /cleanup-image /restorehealth
dism.exe /online /cleanup-image /startcomponentcleanup
sfc /scannow
 
Get-AppXPackage WindowsStore -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}

Strip off HyperV,

bcdedit /set hypervisorlaunchtype off

Disable realtime protection of Windows Defender, or completely shut it down,

gpedit.msc
	Computer Configuration
		Administrative Templates
			Windows Components
				Microsoft Defender Antivirus
					Turn off Microsoft Defender Antivirus
						Enabled

Turn off Windows Update, from https://blog.csdn.net/milaoshu1020/article/details/115062811

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
' switch_win_update_v3.vbs
Const usosvc_reg = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usosvc"
Set fso = createobject("scripting.filesystemobject")
Set shell = createobject("wscript.shell")
curdir = fso.getparentfoldername(wscript.scriptfullname)
 
If wscript.arguments.count = 0 Then
	Set sh = createobject("shell.application")
	sh.shellexecute wscript.fullname,"""" & wscript.scriptfullname & """ -admin",,"runas"
ElseIf wscript.arguments.count = 1 And wscript.arguments(0) = "-admin" Then
	run
Else
	msgbox "Argument error!"
End If
 
Sub Run()
	Do
		ret = inputbox("0: Turn off Win10 Update;" & vbcrlf & _
						"1: Turn on Win10 Update;" & vbcrlf & _
						vbcrlf & _
						"Input:", "Switch Win10 Update v3","0")
		Select Case ret
		Case "0"
			retnum = shell.run("sc.exe stop usosvc",0,True)
			shell.regwrite usosvc_reg & "\WOW64",&H14c,"REG_DWORD"
			msgbox "Turned Win10 Update off!",vbexclamation
			Exit Do
		Case "1"
			shell.regdelete usosvc_reg & "\WOW64"
			retnum = shell.run("sc.exe start usosvc",0,True)
			msgbox "Turned Win10 Update on!",vbexclamation
			Exit Do
		Case ""
			Exit Do
		Case Else
			msgbox "Input mismatch!",vbcritical
		End Select
	Loop
End Sub

After doing those things, in a machine with 8G memory and an SSD, we can play a 4G memory allocated Win10 LTSC 2019 vmware guest and a 2G ubuntu20 one in a silky manner.

refer to:
http://www.xitongcheng.com/jiaocheng/win10_article_42055.html
https://www.bilibili.com/read/cv4183745