Skip to content

Commit

Permalink
remove-appxpackages, prevent windowstore autodownload
Browse files Browse the repository at this point in the history
  • Loading branch information
andif888 committed Oct 27, 2021
1 parent f45d2bb commit 48dddcd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
11 changes: 11 additions & 0 deletions answer_files/10/en/autounattend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@
<Path>a:\vmtools.cmd</Path>
<Order>1</Order>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<WillReboot>Never</WillReboot>
<Path>cmd /c reg add HKLM\SOFTWARE\Polices\Microsoft\WindowStore /v AutoDownload /t REG_DWORD /d 2 /f</Path>
<Order>2</Order>
</RunSynchronousCommand>
</RunSynchronous>
</component>
<component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Expand Down Expand Up @@ -162,6 +167,12 @@
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>5</Order>
<CommandLine>powershell -ExecutionPolicy Bypass -File a:\appx.ps1</CommandLine>
<Description>Remove AppxPackages</Description>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>6</Order>
<CommandLine>powershell -ExecutionPolicy Bypass -File a:\setup.ps1</CommandLine>
<Description>Enable WinRM service</Description>
<RequiresUserInput>true</RequiresUserInput>
Expand Down
11 changes: 11 additions & 0 deletions answer_files/11/en/autounattend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@
<Path>a:\vmtools.cmd</Path>
<Order>1</Order>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<WillReboot>Never</WillReboot>
<Path>cmd /c reg add HKLM\SOFTWARE\Polices\Microsoft\WindowStore /v AutoDownload /t REG_DWORD /d 2 /f</Path>
<Order>2</Order>
</RunSynchronousCommand>
</RunSynchronous>
</component>
<component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Expand Down Expand Up @@ -179,6 +184,12 @@
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>5</Order>
<CommandLine>powershell -ExecutionPolicy Bypass -File a:\appx.ps1</CommandLine>
<Description>Remove AppxPackages</Description>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>6</Order>
<CommandLine>powershell -ExecutionPolicy Bypass -File a:\setup.ps1</CommandLine>
<Description>Enable WinRM service</Description>
<RequiresUserInput>true</RequiresUserInput>
Expand Down
5 changes: 5 additions & 0 deletions setup/appx.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Get-AppXPackage | Where {($_.name -like "*edge*")} | Remove-AppXPackage -ErrorAction SilentlyContinue
Get-AppXPackage | Where {($_.name -like "*549981C3F5F1*")} | Remove-AppXPackage -ErrorAction SilentlyContinue
Get-AppXPackage | Where {($_.name -like "*Bing*")} | Remove-AppXPackage -ErrorAction SilentlyContinue
Get-AppXPackage | Where {($_.name -like "*OneDrive*")} | Remove-AppXPackage -ErrorAction SilentlyContinue
Get-AppXPackage | Where {($_.NonRemovable -eq $false) -and ($_.IsFramework -eq $false)} | Remove-AppXPackage -ErrorAction SilentlyContinue
2 changes: 1 addition & 1 deletion windows.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ source "vsphere-iso" "windows" {
RAM_reserve_all = true
disk_controller_type = ["pvscsi"]
# firmware = "bios"
floppy_files = ["${var.autounattend_file}", "setup/setup.ps1", "setup/vmtools.cmd"]
floppy_files = ["${var.autounattend_file}", "setup/setup.ps1", "setup/vmtools.cmd", "setup/appx.ps1"]
floppy_img_path = "${var.floppy_pvscsi}"
guest_os_type = "${var.vsphere_guest_os_type}"
iso_checksum = "${var.os_iso_checksum}"
Expand Down

0 comments on commit 48dddcd

Please sign in to comment.