[{"data":1,"prerenderedAt":2160},["ShallowReactive",2],{"post:\u002F2025\u002F07\u002F16\u002Fpowershell-windows-11-debloat-a-golden-image-before-sysprep\u002F":3},{"post":4,"newer":2107,"older":2119,"related":2129,"series":2158},{"id":5,"title":6,"body":7,"canonical":2088,"categories":2089,"date":2092,"description":2093,"extension":2094,"featured":2095,"hero":2096,"image":2096,"meta":2097,"navigation":568,"path":2098,"readingTime":391,"seo":2099,"series":2096,"seriesOrder":2096,"sites":2100,"source":2096,"stem":2101,"tags":2102,"updated":2096,"url":2105,"__hash__":2106},"blog\u002Fblog\u002F2025\u002F07\u002F16\u002Fpowershell-windows-11-debloat-a-golden-image-before-sysprep.md","PowerShell: Windows 11 – Debloat a Golden Image Before Sysprep",{"type":8,"value":9,"toc":2080},"minimark",[10,19,46,51,95,99,184,188,191,218,226,229,245,252,308,311,353,360,364,1935,1939,2015,2019,2076],[11,12,13,14,18],"p",{},"Every Windows 11 reference image I build starts the same way: install, patch, then spend twenty minutes ripping out Xbox overlays, Solitaire, the news and weather apps, and the OneDrive setup that otherwise greets every new profile created from the image. Doing that by hand in the Store or per user doesn't stick once you sysprep and capture, because provisioned packages and the Default user profile are exactly what get baked into every new user session. This script removes matching AppX packages for every account on the reference machine ",[15,16,17],"em",{},"and"," from the provisioned list, sets the consumer-experience and Widgets policies, and (unless you tell it to keep it) removes the OneDrive setup trigger from the Default user hive.",[11,20,21,22,26,27,30,31,34,35,38,39,41,42,45],{},"The order matters. Microsoft's support article on Sysprep failures describes exactly what happens if you only deprovision: when a package is removed from provisioning but is still installed for the account doing the image prep, ",[23,24,25],"code",{},"Sysprep \u002Fgeneralize"," fails with ",[23,28,29],{},"SYSPRP Package \u003CPackageFullName> was installed for a user, but not provisioned for all users"," followed by ",[23,32,33],{},"0x80073cf2",". The fix Microsoft documents is to remove the package for the user with ",[23,36,37],{},"Remove-AppxPackage"," ",[15,40,17],{}," remove the provisioning with ",[23,43,44],{},"Remove-AppxProvisionedPackage",", which is what this script does, in that order.",[47,48,50],"h2",{"id":49},"requirements","Requirements",[52,53,54,66,72,79,85],"ul",{},[55,56,57,58,61,62,65],"li",{},"Windows PowerShell 5.1, run elevated. The ",[23,59,60],{},"Appx"," and ",[23,63,64],{},"Dism"," modules ship in the box.",[55,67,68,69,71],{},"Run on the reference machine itself, in audit mode, before ",[23,70,25],{},".",[55,73,74,75,78],{},"Local administrator rights. ",[23,76,77],{},"Remove-AppxPackage -AllUsers"," requires an elevated session.",[55,80,81,82,84],{},"Disconnect the reference machine from the internet, or disable Store automatic updates, while you build it. Microsoft notes that a Store app updated during image prep also breaks Sysprep with the same ",[23,83,33],{}," error.",[55,86,87,88,61,91,94],{},"The ",[23,89,90],{},"DisableWindowsConsumerFeatures",[23,92,93],{},"DisableSoftLanding"," policies are only honored on Enterprise and Education editions (per the Experience Policy CSP reference). They are harmless but ignored on Pro.",[47,96,98],{"id":97},"parameters","Parameters",[100,101,102,121],"table",{},[103,104,105],"thead",{},[106,107,108,112,115,118],"tr",{},[109,110,111],"th",{},"Name",[109,113,114],{},"Type",[109,116,117],{},"Required",[109,119,120],{},"Description",[122,123,124,151,166],"tbody",{},[106,125,126,132,138,141],{},[127,128,129],"td",{},[23,130,131],{},"-AppNamePattern",[127,133,134,135],{},"string",[136,137],"span",{},[127,139,140],{},"No",[127,142,143,144,146,147,150],{},"Wildcard patterns matched against package names (",[23,145,111],{}," for installed packages, ",[23,148,149],{},"DisplayName"," for provisioned ones). Defaults to a built-in list of consumer apps.",[106,152,153,158,161,163],{},[127,154,155],{},[23,156,157],{},"-KeepOneDrive",[127,159,160],{},"switch",[127,162,140],{},[127,164,165],{},"Skip the Default user hive change, so new profiles still run OneDrive setup at first sign-in.",[106,167,168,173,175,177],{},[127,169,170],{},[23,171,172],{},"-WhatIf",[127,174,160],{},[127,176,140],{},[127,178,179,180,183],{},"Built-in ",[23,181,182],{},"ShouldProcess"," support: preview every removal and registry change without applying it.",[47,185,187],{"id":186},"usage","Usage",[11,189,190],{},"Preview what the script would remove before touching the reference image:",[192,193,198],"pre",{"className":194,"code":195,"language":196,"meta":197,"style":197},"language-powershell shiki shiki-themes github-dark",".\\Remove-GoldenImageBloat.ps1 -WhatIf\n","powershell","",[23,199,200],{"__ignoreMap":197},[136,201,204,207,211,215],{"class":202,"line":203},"line",1,[136,205,71],{"class":206},"s95oV",[136,208,210],{"class":209},"sDLfK","\\Remove-GoldenImageBloat.ps1",[136,212,214],{"class":213},"snl16"," -",[136,216,217],{"class":206},"WhatIf\n",[192,219,224],{"className":220,"code":222,"language":223,"meta":197},[221],"language-text","Found 14 installed and 14 provisioned package(s) matching the pattern list.\nWhat if: Performing the operation \"Remove-AppxPackage -AllUsers\" on target \"Microsoft.BingNews_4.55.62231.0_x64__8wekyb3d8bbwe\".\nWhat if: Performing the operation \"Remove-AppxProvisionedPackage\" on target \"Microsoft.BingNews\".\n...\nWhat if: Performing the operation \"Set consumer experience policies\" on target \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\CloudContent\".\nWhat if: Performing the operation \"Disable Widgets (AllowNewsAndInterests = 0)\" on target \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Dsh\".\nWhat if: Performing the operation \"Remove OneDriveSetup Run value from the Default user hive\" on target \"C:\\Users\\Default\\NTUSER.DAT\".\n","text",[23,225,222],{"__ignoreMap":197},[11,227,228],{},"Run it for real, keeping OneDrive because this particular image ships to users who rely on it:",[192,230,232],{"className":194,"code":231,"language":196,"meta":197,"style":197},".\\Remove-GoldenImageBloat.ps1 -KeepOneDrive\n",[23,233,234],{"__ignoreMap":197},[136,235,236,238,240,242],{"class":202,"line":203},[136,237,71],{"class":206},[136,239,210],{"class":209},[136,241,214],{"class":213},[136,243,244],{"class":206},"KeepOneDrive\n",[11,246,247,248,251],{},"Before generalizing, confirm nothing from the list is still installed for any account. This is the check Microsoft's Sysprep article uses; any package that shows ",[23,249,250],{},"Installed"," for a user will break the generalize pass:",[192,253,255],{"className":194,"code":254,"language":196,"meta":197,"style":197},"Get-AppxPackage -AllUsers | Where-Object { $_.PublisherId -eq \"8wekyb3d8bbwe\" } | Format-List -Property PackageFullName, PackageUserInformation\n",[23,256,257],{"__ignoreMap":197},[136,258,259,262,264,267,270,273,276,279,282,285,289,292,294,297,299,302,305],{"class":202,"line":203},[136,260,261],{"class":209},"Get-AppxPackage",[136,263,214],{"class":213},[136,265,266],{"class":206},"AllUsers ",[136,268,269],{"class":213},"|",[136,271,272],{"class":209}," Where-Object",[136,274,275],{"class":206}," { ",[136,277,278],{"class":209},"$_",[136,280,281],{"class":206},".PublisherId ",[136,283,284],{"class":213},"-eq",[136,286,288],{"class":287},"sU2Wk"," \"8wekyb3d8bbwe\"",[136,290,291],{"class":206}," } ",[136,293,269],{"class":213},[136,295,296],{"class":209}," Format-List",[136,298,214],{"class":213},[136,300,301],{"class":206},"Property PackageFullName",[136,303,304],{"class":213},",",[136,306,307],{"class":206}," PackageUserInformation\n",[11,309,310],{},"Then generalize and shut down for capture:",[192,312,314],{"className":194,"code":313,"language":196,"meta":197,"style":197},"& \"$env:SystemRoot\\System32\\Sysprep\\Sysprep.exe\" \u002Fgeneralize \u002Foobe \u002Fshutdown\n",[23,315,316],{"__ignoreMap":197},[136,317,318,321,324,327,330,333,336,339,342,345,348,350],{"class":202,"line":203},[136,319,320],{"class":213},"&",[136,322,323],{"class":287}," \"",[136,325,326],{"class":206},"$",[136,328,329],{"class":209},"env:",[136,331,332],{"class":206},"SystemRoot",[136,334,335],{"class":287},"\\System32\\Sysprep\\Sysprep.exe\"",[136,337,338],{"class":213}," \u002F",[136,340,341],{"class":206},"generalize ",[136,343,344],{"class":213},"\u002F",[136,346,347],{"class":206},"oobe ",[136,349,344],{"class":213},[136,351,352],{"class":206},"shutdown\n",[11,354,355,356,359],{},"Add ",[23,357,358],{},"\u002Fmode:vm"," only if the captured VHD will be deployed back onto the same hypervisor with the same hardware profile. The Sysprep documentation is explicit that VM mode must be run inside a VM and that deploying to a different hardware profile can cause unexpected issues.",[47,361,363],{"id":362},"script","Script",[192,365,367],{"className":194,"code":366,"language":196,"meta":197,"style":197},"\u003C#\n.SYNOPSIS\n    Removes consumer AppX packages from a Windows 11 reference machine for all users and\n    from provisioning, and sets consumer-experience policies before Sysprep.\n.DESCRIPTION\n    For each name pattern, removes matching installed AppX packages for every user\n    account (Remove-AppxPackage -AllUsers), then removes the matching provisioned\n    packages (Remove-AppxProvisionedPackage -Online) so they never install for new\n    profiles. Removing both avoids the documented Sysprep failure 0x80073cf2 (\"installed\n    for a user, but not provisioned for all users\"). Sets the CloudContent consumer\n    experience policies and the Widgets policy, and unless -KeepOneDrive is supplied,\n    removes the OneDriveSetup Run value from the Default user hive. Run in audit mode,\n    before Sysprep \u002Fgeneralize.\n.PARAMETER AppNamePattern\n    Wildcard patterns matched against package names. Defaults to a list of common\n    consumer apps.\n.PARAMETER KeepOneDrive\n    Skip the Default user hive change so new profiles still run OneDrive setup.\n.EXAMPLE\n    .\\Remove-GoldenImageBloat.ps1 -WhatIf\n.EXAMPLE\n    .\\Remove-GoldenImageBloat.ps1 -KeepOneDrive\n.NOTES\n    Author  : Thomas Lasswell (https:\u002F\u002Fwww.techcolumnist.com)\n    Version : 1.0 (2025-07-16)\n    Requires: Windows PowerShell 5.1, elevated; Appx and Dism modules (in box)\n.LINK\n    https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Ftroubleshoot\u002Fwindows-client\u002Fsetup-upgrade-and-drivers\u002Fsysprep-fails-remove-or-update-store-apps\n#>\n\n#Requires -RunAsAdministrator\n\n[CmdletBinding(SupportsShouldProcess = $true)]\nparam (\n    [Parameter()]\n    [string[]]$AppNamePattern = @(\n        \"Clipchamp.Clipchamp\",\n        \"Microsoft.BingNews\",\n        \"Microsoft.BingWeather\",\n        \"Microsoft.GamingApp\",\n        \"Microsoft.GetHelp\",\n        \"Microsoft.Getstarted\",\n        \"Microsoft.MicrosoftSolitaireCollection\",\n        \"Microsoft.PowerAutomateDesktop\",\n        \"Microsoft.Todos\",\n        \"Microsoft.WindowsFeedbackHub\",\n        \"Microsoft.Xbox.TCUI\",\n        \"Microsoft.XboxGamingOverlay\",\n        \"Microsoft.XboxSpeechToTextOverlay\",\n        \"Microsoft.YourPhone\",\n        \"Microsoft.ZuneMusic\",\n        \"Microsoft.ZuneVideo\"\n    ),\n\n    [Parameter()]\n    [switch]$KeepOneDrive\n)\n\n# Return $true when a package name matches any pattern in the list.\nfunction Test-NameMatch {\n    param (\n        [string]$Name,\n        [string[]]$Pattern\n    )\n\n    foreach ($p in $Pattern) {\n        if ($Name -like $p) {\n            return $true\n        }\n    }\n\n    return $false\n}\n\n$installed = @(Get-AppxPackage -AllUsers | Where-Object { Test-NameMatch -Name $_.Name -Pattern $AppNamePattern })\n$provisioned = @(Get-AppxProvisionedPackage -Online | Where-Object { Test-NameMatch -Name $_.DisplayName -Pattern $AppNamePattern })\n\nWrite-Host \"Found $($installed.Count) installed and $($provisioned.Count) provisioned package(s) matching the pattern list.\"\n\n# Remove the installed copies for every account first, so Sysprep does not find a\n# per-user install of a package that is no longer provisioned.\nforeach ($package in $installed) {\n    if ($PSCmdlet.ShouldProcess($package.PackageFullName, \"Remove-AppxPackage -AllUsers\")) {\n        try {\n            Remove-AppxPackage -Package $package.PackageFullName -AllUsers -ErrorAction Stop\n            Write-Host \"Removed installed package: $($package.PackageFullName)\"\n        } catch {\n            Write-Warning \"Could not remove $($package.PackageFullName): $($_.Exception.Message)\"\n        }\n    }\n}\n\n# Then remove the provisioned copy so new profiles never receive it.\nforeach ($package in $provisioned) {\n    if ($PSCmdlet.ShouldProcess($package.DisplayName, \"Remove-AppxProvisionedPackage\")) {\n        try {\n            Remove-AppxProvisionedPackage -Online -PackageName $package.PackageName -AllUsers -ErrorAction Stop | Out-Null\n            Write-Host \"Removed provisioned package: $($package.DisplayName)\"\n        } catch {\n            Write-Warning \"Could not deprovision $($package.DisplayName): $($_.Exception.Message)\"\n        }\n    }\n}\n\n# Consumer experiences and Windows tips (honored on Enterprise and Education only).\n$cloudContentPath = \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\CloudContent\"\nif ($PSCmdlet.ShouldProcess($cloudContentPath, \"Set consumer experience policies\")) {\n    New-Item -Path $cloudContentPath -Force | Out-Null\n    New-ItemProperty -Path $cloudContentPath -Name \"DisableWindowsConsumerFeatures\" -Value 1 -PropertyType DWord -Force | Out-Null\n    New-ItemProperty -Path $cloudContentPath -Name \"DisableSoftLanding\" -Value 1 -PropertyType DWord -Force | Out-Null\n}\n\n# Widgets (\"Allow widgets\" policy, NewsAndInterests.admx).\n$dshPath = \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Dsh\"\nif ($PSCmdlet.ShouldProcess($dshPath, \"Disable Widgets (AllowNewsAndInterests = 0)\")) {\n    New-Item -Path $dshPath -Force | Out-Null\n    New-ItemProperty -Path $dshPath -Name \"AllowNewsAndInterests\" -Value 0 -PropertyType DWord -Force | Out-Null\n}\n\nif (-not $KeepOneDrive) {\n    # New profiles run OneDrive setup from a Run value in the Default user hive.\n    $defaultHive = \"$env:SystemDrive\\Users\\Default\\NTUSER.DAT\"\n    $mountKey = \"HKU\\DefaultUserTemp\"\n    $runKey = \"Registry::HKEY_USERS\\DefaultUserTemp\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\"\n\n    if ((Test-Path -Path $defaultHive) -and $PSCmdlet.ShouldProcess($defaultHive, \"Remove OneDriveSetup Run value from the Default user hive\")) {\n        & reg.exe load $mountKey $defaultHive | Out-Null\n\n        try {\n            if (Get-ItemProperty -Path $runKey -Name \"OneDriveSetup\" -ErrorAction SilentlyContinue) {\n                Remove-ItemProperty -Path $runKey -Name \"OneDriveSetup\"\n                Write-Host \"Removed OneDriveSetup from the Default user Run key.\"\n            } else {\n                Write-Host \"No OneDriveSetup value in the Default user Run key.\"\n            }\n        } finally {\n            # Release any handles PowerShell holds on the hive before unloading it.\n            [gc]::Collect()\n            [gc]::WaitForPendingFinalizers()\n            Start-Sleep -Seconds 1\n            & reg.exe unload $mountKey | Out-Null\n        }\n    }\n}\n\nWrite-Host \"Done. Verify with Get-AppxPackage -AllUsers, then run Sysprep \u002Fgeneralize.\"\n",[23,368,369,375,383,389,395,403,409,415,421,427,433,439,445,451,462,468,474,484,490,498,504,511,517,525,531,537,543,551,557,563,570,579,584,609,618,630,649,658,666,674,682,690,698,706,714,722,730,738,746,754,762,770,776,784,789,798,808,814,819,825,838,846,859,869,875,880,895,910,919,925,931,936,945,951,956,999,1040,1045,1079,1084,1090,1096,1110,1133,1141,1161,1182,1193,1226,1231,1236,1241,1246,1252,1264,1283,1290,1319,1338,1347,1377,1382,1387,1392,1397,1403,1414,1434,1454,1492,1526,1531,1536,1542,1553,1572,1590,1625,1630,1635,1648,1654,1674,1685,1696,1701,1733,1749,1754,1761,1789,1806,1815,1826,1834,1840,1850,1856,1868,1878,1892,1907,1912,1917,1922,1927],{"__ignoreMap":197},[136,370,371],{"class":202,"line":203},[136,372,374],{"class":373},"sAwPA","\u003C#\n",[136,376,378,380],{"class":202,"line":377},2,[136,379,71],{"class":209},[136,381,382],{"class":213},"SYNOPSIS\n",[136,384,386],{"class":202,"line":385},3,[136,387,388],{"class":373},"    Removes consumer AppX packages from a Windows 11 reference machine for all users and\n",[136,390,392],{"class":202,"line":391},4,[136,393,394],{"class":373},"    from provisioning, and sets consumer-experience policies before Sysprep.\n",[136,396,398,400],{"class":202,"line":397},5,[136,399,71],{"class":209},[136,401,402],{"class":213},"DESCRIPTION\n",[136,404,406],{"class":202,"line":405},6,[136,407,408],{"class":373},"    For each name pattern, removes matching installed AppX packages for every user\n",[136,410,412],{"class":202,"line":411},7,[136,413,414],{"class":373},"    account (Remove-AppxPackage -AllUsers), then removes the matching provisioned\n",[136,416,418],{"class":202,"line":417},8,[136,419,420],{"class":373},"    packages (Remove-AppxProvisionedPackage -Online) so they never install for new\n",[136,422,424],{"class":202,"line":423},9,[136,425,426],{"class":373},"    profiles. Removing both avoids the documented Sysprep failure 0x80073cf2 (\"installed\n",[136,428,430],{"class":202,"line":429},10,[136,431,432],{"class":373},"    for a user, but not provisioned for all users\"). Sets the CloudContent consumer\n",[136,434,436],{"class":202,"line":435},11,[136,437,438],{"class":373},"    experience policies and the Widgets policy, and unless -KeepOneDrive is supplied,\n",[136,440,442],{"class":202,"line":441},12,[136,443,444],{"class":373},"    removes the OneDriveSetup Run value from the Default user hive. Run in audit mode,\n",[136,446,448],{"class":202,"line":447},13,[136,449,450],{"class":373},"    before Sysprep \u002Fgeneralize.\n",[136,452,454,456,459],{"class":202,"line":453},14,[136,455,71],{"class":209},[136,457,458],{"class":213},"PARAMETER",[136,460,461],{"class":213}," AppNamePattern\n",[136,463,465],{"class":202,"line":464},15,[136,466,467],{"class":373},"    Wildcard patterns matched against package names. Defaults to a list of common\n",[136,469,471],{"class":202,"line":470},16,[136,472,473],{"class":373},"    consumer apps.\n",[136,475,477,479,481],{"class":202,"line":476},17,[136,478,71],{"class":209},[136,480,458],{"class":213},[136,482,483],{"class":213}," KeepOneDrive\n",[136,485,487],{"class":202,"line":486},18,[136,488,489],{"class":373},"    Skip the Default user hive change so new profiles still run OneDrive setup.\n",[136,491,493,495],{"class":202,"line":492},19,[136,494,71],{"class":209},[136,496,497],{"class":213},"EXAMPLE\n",[136,499,501],{"class":202,"line":500},20,[136,502,503],{"class":373},"    .\\Remove-GoldenImageBloat.ps1 -WhatIf\n",[136,505,507,509],{"class":202,"line":506},21,[136,508,71],{"class":209},[136,510,497],{"class":213},[136,512,514],{"class":202,"line":513},22,[136,515,516],{"class":373},"    .\\Remove-GoldenImageBloat.ps1 -KeepOneDrive\n",[136,518,520,522],{"class":202,"line":519},23,[136,521,71],{"class":209},[136,523,524],{"class":213},"NOTES\n",[136,526,528],{"class":202,"line":527},24,[136,529,530],{"class":373},"    Author  : Thomas Lasswell (https:\u002F\u002Fwww.techcolumnist.com)\n",[136,532,534],{"class":202,"line":533},25,[136,535,536],{"class":373},"    Version : 1.0 (2025-07-16)\n",[136,538,540],{"class":202,"line":539},26,[136,541,542],{"class":373},"    Requires: Windows PowerShell 5.1, elevated; Appx and Dism modules (in box)\n",[136,544,546,548],{"class":202,"line":545},27,[136,547,71],{"class":209},[136,549,550],{"class":213},"LINK\n",[136,552,554],{"class":202,"line":553},28,[136,555,556],{"class":373},"    https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Ftroubleshoot\u002Fwindows-client\u002Fsetup-upgrade-and-drivers\u002Fsysprep-fails-remove-or-update-store-apps\n",[136,558,560],{"class":202,"line":559},29,[136,561,562],{"class":373},"#>\n",[136,564,566],{"class":202,"line":565},30,[136,567,569],{"emptyLinePlaceholder":568},true,"\n",[136,571,573,576],{"class":202,"line":572},31,[136,574,575],{"class":373},"#",[136,577,578],{"class":213},"Requires -RunAsAdministrator\n",[136,580,582],{"class":202,"line":581},32,[136,583,569],{"emptyLinePlaceholder":568},[136,585,587,590,593,596,600,603,606],{"class":202,"line":586},33,[136,588,589],{"class":206},"[",[136,591,592],{"class":209},"CmdletBinding",[136,594,595],{"class":206},"(",[136,597,599],{"class":598},"s9osk","SupportsShouldProcess",[136,601,602],{"class":213}," =",[136,604,605],{"class":209}," $true",[136,607,608],{"class":206},")]\n",[136,610,612,615],{"class":202,"line":611},34,[136,613,614],{"class":213},"param",[136,616,617],{"class":206}," (\n",[136,619,621,624,627],{"class":202,"line":620},35,[136,622,623],{"class":206},"    [",[136,625,626],{"class":209},"Parameter",[136,628,629],{"class":206},"()]\n",[136,631,633,635,637,640,643,646],{"class":202,"line":632},36,[136,634,623],{"class":206},[136,636,134],{"class":213},[136,638,639],{"class":206},"[]]$AppNamePattern ",[136,641,642],{"class":213},"=",[136,644,645],{"class":213}," @",[136,647,648],{"class":206},"(\n",[136,650,652,655],{"class":202,"line":651},37,[136,653,654],{"class":287},"        \"Clipchamp.Clipchamp\"",[136,656,657],{"class":213},",\n",[136,659,661,664],{"class":202,"line":660},38,[136,662,663],{"class":287},"        \"Microsoft.BingNews\"",[136,665,657],{"class":213},[136,667,669,672],{"class":202,"line":668},39,[136,670,671],{"class":287},"        \"Microsoft.BingWeather\"",[136,673,657],{"class":213},[136,675,677,680],{"class":202,"line":676},40,[136,678,679],{"class":287},"        \"Microsoft.GamingApp\"",[136,681,657],{"class":213},[136,683,685,688],{"class":202,"line":684},41,[136,686,687],{"class":287},"        \"Microsoft.GetHelp\"",[136,689,657],{"class":213},[136,691,693,696],{"class":202,"line":692},42,[136,694,695],{"class":287},"        \"Microsoft.Getstarted\"",[136,697,657],{"class":213},[136,699,701,704],{"class":202,"line":700},43,[136,702,703],{"class":287},"        \"Microsoft.MicrosoftSolitaireCollection\"",[136,705,657],{"class":213},[136,707,709,712],{"class":202,"line":708},44,[136,710,711],{"class":287},"        \"Microsoft.PowerAutomateDesktop\"",[136,713,657],{"class":213},[136,715,717,720],{"class":202,"line":716},45,[136,718,719],{"class":287},"        \"Microsoft.Todos\"",[136,721,657],{"class":213},[136,723,725,728],{"class":202,"line":724},46,[136,726,727],{"class":287},"        \"Microsoft.WindowsFeedbackHub\"",[136,729,657],{"class":213},[136,731,733,736],{"class":202,"line":732},47,[136,734,735],{"class":287},"        \"Microsoft.Xbox.TCUI\"",[136,737,657],{"class":213},[136,739,741,744],{"class":202,"line":740},48,[136,742,743],{"class":287},"        \"Microsoft.XboxGamingOverlay\"",[136,745,657],{"class":213},[136,747,749,752],{"class":202,"line":748},49,[136,750,751],{"class":287},"        \"Microsoft.XboxSpeechToTextOverlay\"",[136,753,657],{"class":213},[136,755,757,760],{"class":202,"line":756},50,[136,758,759],{"class":287},"        \"Microsoft.YourPhone\"",[136,761,657],{"class":213},[136,763,765,768],{"class":202,"line":764},51,[136,766,767],{"class":287},"        \"Microsoft.ZuneMusic\"",[136,769,657],{"class":213},[136,771,773],{"class":202,"line":772},52,[136,774,775],{"class":287},"        \"Microsoft.ZuneVideo\"\n",[136,777,779,782],{"class":202,"line":778},53,[136,780,781],{"class":206},"    )",[136,783,657],{"class":213},[136,785,787],{"class":202,"line":786},54,[136,788,569],{"emptyLinePlaceholder":568},[136,790,792,794,796],{"class":202,"line":791},55,[136,793,623],{"class":206},[136,795,626],{"class":209},[136,797,629],{"class":206},[136,799,801,803,805],{"class":202,"line":800},56,[136,802,623],{"class":206},[136,804,160],{"class":213},[136,806,807],{"class":206},"]$KeepOneDrive\n",[136,809,811],{"class":202,"line":810},57,[136,812,813],{"class":206},")\n",[136,815,817],{"class":202,"line":816},58,[136,818,569],{"emptyLinePlaceholder":568},[136,820,822],{"class":202,"line":821},59,[136,823,824],{"class":373},"# Return $true when a package name matches any pattern in the list.\n",[136,826,828,831,835],{"class":202,"line":827},60,[136,829,830],{"class":213},"function",[136,832,834],{"class":833},"svObZ"," Test-NameMatch",[136,836,837],{"class":206}," {\n",[136,839,841,844],{"class":202,"line":840},61,[136,842,843],{"class":213},"    param",[136,845,617],{"class":206},[136,847,849,852,854,857],{"class":202,"line":848},62,[136,850,851],{"class":206},"        [",[136,853,134],{"class":213},[136,855,856],{"class":206},"]$Name",[136,858,657],{"class":213},[136,860,862,864,866],{"class":202,"line":861},63,[136,863,851],{"class":206},[136,865,134],{"class":213},[136,867,868],{"class":206},"[]]$Pattern\n",[136,870,872],{"class":202,"line":871},64,[136,873,874],{"class":206},"    )\n",[136,876,878],{"class":202,"line":877},65,[136,879,569],{"emptyLinePlaceholder":568},[136,881,883,886,889,892],{"class":202,"line":882},66,[136,884,885],{"class":213},"    foreach",[136,887,888],{"class":206}," ($p ",[136,890,891],{"class":213},"in",[136,893,894],{"class":206}," $Pattern) {\n",[136,896,898,901,904,907],{"class":202,"line":897},67,[136,899,900],{"class":213},"        if",[136,902,903],{"class":206}," ($Name ",[136,905,906],{"class":213},"-like",[136,908,909],{"class":206}," $p) {\n",[136,911,913,916],{"class":202,"line":912},68,[136,914,915],{"class":213},"            return",[136,917,918],{"class":209}," $true\n",[136,920,922],{"class":202,"line":921},69,[136,923,924],{"class":206},"        }\n",[136,926,928],{"class":202,"line":927},70,[136,929,930],{"class":206},"    }\n",[136,932,934],{"class":202,"line":933},71,[136,935,569],{"emptyLinePlaceholder":568},[136,937,939,942],{"class":202,"line":938},72,[136,940,941],{"class":213},"    return",[136,943,944],{"class":209}," $false\n",[136,946,948],{"class":202,"line":947},73,[136,949,950],{"class":206},"}\n",[136,952,954],{"class":202,"line":953},74,[136,955,569],{"emptyLinePlaceholder":568},[136,957,959,962,964,966,968,970,972,974,976,978,980,983,985,988,990,993,996],{"class":202,"line":958},75,[136,960,961],{"class":206},"$installed ",[136,963,642],{"class":213},[136,965,645],{"class":213},[136,967,595],{"class":206},[136,969,261],{"class":209},[136,971,214],{"class":213},[136,973,266],{"class":206},[136,975,269],{"class":213},[136,977,272],{"class":209},[136,979,275],{"class":206},[136,981,982],{"class":209},"Test-NameMatch",[136,984,214],{"class":213},[136,986,987],{"class":206},"Name ",[136,989,278],{"class":209},[136,991,992],{"class":206},".Name ",[136,994,995],{"class":213},"-",[136,997,998],{"class":206},"Pattern $AppNamePattern })\n",[136,1000,1002,1005,1007,1009,1011,1014,1016,1019,1021,1023,1025,1027,1029,1031,1033,1036,1038],{"class":202,"line":1001},76,[136,1003,1004],{"class":206},"$provisioned ",[136,1006,642],{"class":213},[136,1008,645],{"class":213},[136,1010,595],{"class":206},[136,1012,1013],{"class":209},"Get-AppxProvisionedPackage",[136,1015,214],{"class":213},[136,1017,1018],{"class":206},"Online ",[136,1020,269],{"class":213},[136,1022,272],{"class":209},[136,1024,275],{"class":206},[136,1026,982],{"class":209},[136,1028,214],{"class":213},[136,1030,987],{"class":206},[136,1032,278],{"class":209},[136,1034,1035],{"class":206},".DisplayName ",[136,1037,995],{"class":213},[136,1039,998],{"class":206},[136,1041,1043],{"class":202,"line":1042},77,[136,1044,569],{"emptyLinePlaceholder":568},[136,1046,1048,1051,1054,1056,1058,1061,1064,1067,1069,1071,1074,1076],{"class":202,"line":1047},78,[136,1049,1050],{"class":209},"Write-Host",[136,1052,1053],{"class":287}," \"Found ",[136,1055,326],{"class":213},[136,1057,595],{"class":287},[136,1059,1060],{"class":206},"$installed.Count",[136,1062,1063],{"class":287},")",[136,1065,1066],{"class":287}," installed and ",[136,1068,326],{"class":213},[136,1070,595],{"class":287},[136,1072,1073],{"class":206},"$provisioned.Count",[136,1075,1063],{"class":287},[136,1077,1078],{"class":287}," provisioned package(s) matching the pattern list.\"\n",[136,1080,1082],{"class":202,"line":1081},79,[136,1083,569],{"emptyLinePlaceholder":568},[136,1085,1087],{"class":202,"line":1086},80,[136,1088,1089],{"class":373},"# Remove the installed copies for every account first, so Sysprep does not find a\n",[136,1091,1093],{"class":202,"line":1092},81,[136,1094,1095],{"class":373},"# per-user install of a package that is no longer provisioned.\n",[136,1097,1099,1102,1105,1107],{"class":202,"line":1098},82,[136,1100,1101],{"class":213},"foreach",[136,1103,1104],{"class":206}," ($package ",[136,1106,891],{"class":213},[136,1108,1109],{"class":206}," $installed) {\n",[136,1111,1113,1116,1119,1122,1125,1127,1130],{"class":202,"line":1112},83,[136,1114,1115],{"class":213},"    if",[136,1117,1118],{"class":206}," (",[136,1120,1121],{"class":209},"$PSCmdlet",[136,1123,1124],{"class":206},".ShouldProcess($package.PackageFullName",[136,1126,304],{"class":213},[136,1128,1129],{"class":287}," \"Remove-AppxPackage -AllUsers\"",[136,1131,1132],{"class":206},")) {\n",[136,1134,1136,1139],{"class":202,"line":1135},84,[136,1137,1138],{"class":213},"        try",[136,1140,837],{"class":206},[136,1142,1144,1147,1149,1152,1154,1156,1158],{"class":202,"line":1143},85,[136,1145,1146],{"class":209},"            Remove-AppxPackage",[136,1148,214],{"class":213},[136,1150,1151],{"class":206},"Package $package.PackageFullName ",[136,1153,995],{"class":213},[136,1155,266],{"class":206},[136,1157,995],{"class":213},[136,1159,1160],{"class":206},"ErrorAction Stop\n",[136,1162,1164,1167,1170,1172,1174,1177,1179],{"class":202,"line":1163},86,[136,1165,1166],{"class":209},"            Write-Host",[136,1168,1169],{"class":287}," \"Removed installed package: ",[136,1171,326],{"class":213},[136,1173,595],{"class":287},[136,1175,1176],{"class":206},"$package.PackageFullName",[136,1178,1063],{"class":287},[136,1180,1181],{"class":287},"\"\n",[136,1183,1185,1188,1191],{"class":202,"line":1184},87,[136,1186,1187],{"class":206},"        } ",[136,1189,1190],{"class":213},"catch",[136,1192,837],{"class":206},[136,1194,1196,1199,1202,1204,1206,1208,1210,1213,1215,1217,1219,1222,1224],{"class":202,"line":1195},88,[136,1197,1198],{"class":209},"            Write-Warning",[136,1200,1201],{"class":287}," \"Could not remove ",[136,1203,326],{"class":213},[136,1205,595],{"class":287},[136,1207,1176],{"class":206},[136,1209,1063],{"class":287},[136,1211,1212],{"class":287},": ",[136,1214,326],{"class":213},[136,1216,595],{"class":287},[136,1218,278],{"class":209},[136,1220,1221],{"class":206},".Exception.Message",[136,1223,1063],{"class":287},[136,1225,1181],{"class":287},[136,1227,1229],{"class":202,"line":1228},89,[136,1230,924],{"class":206},[136,1232,1234],{"class":202,"line":1233},90,[136,1235,930],{"class":206},[136,1237,1239],{"class":202,"line":1238},91,[136,1240,950],{"class":206},[136,1242,1244],{"class":202,"line":1243},92,[136,1245,569],{"emptyLinePlaceholder":568},[136,1247,1249],{"class":202,"line":1248},93,[136,1250,1251],{"class":373},"# Then remove the provisioned copy so new profiles never receive it.\n",[136,1253,1255,1257,1259,1261],{"class":202,"line":1254},94,[136,1256,1101],{"class":213},[136,1258,1104],{"class":206},[136,1260,891],{"class":213},[136,1262,1263],{"class":206}," $provisioned) {\n",[136,1265,1267,1269,1271,1273,1276,1278,1281],{"class":202,"line":1266},95,[136,1268,1115],{"class":213},[136,1270,1118],{"class":206},[136,1272,1121],{"class":209},[136,1274,1275],{"class":206},".ShouldProcess($package.DisplayName",[136,1277,304],{"class":213},[136,1279,1280],{"class":287}," \"Remove-AppxProvisionedPackage\"",[136,1282,1132],{"class":206},[136,1284,1286,1288],{"class":202,"line":1285},96,[136,1287,1138],{"class":213},[136,1289,837],{"class":206},[136,1291,1293,1296,1298,1300,1302,1305,1307,1309,1311,1314,1316],{"class":202,"line":1292},97,[136,1294,1295],{"class":209},"            Remove-AppxProvisionedPackage",[136,1297,214],{"class":213},[136,1299,1018],{"class":206},[136,1301,995],{"class":213},[136,1303,1304],{"class":206},"PackageName $package.PackageName ",[136,1306,995],{"class":213},[136,1308,266],{"class":206},[136,1310,995],{"class":213},[136,1312,1313],{"class":206},"ErrorAction Stop ",[136,1315,269],{"class":213},[136,1317,1318],{"class":209}," Out-Null\n",[136,1320,1322,1324,1327,1329,1331,1334,1336],{"class":202,"line":1321},98,[136,1323,1166],{"class":209},[136,1325,1326],{"class":287}," \"Removed provisioned package: ",[136,1328,326],{"class":213},[136,1330,595],{"class":287},[136,1332,1333],{"class":206},"$package.DisplayName",[136,1335,1063],{"class":287},[136,1337,1181],{"class":287},[136,1339,1341,1343,1345],{"class":202,"line":1340},99,[136,1342,1187],{"class":206},[136,1344,1190],{"class":213},[136,1346,837],{"class":206},[136,1348,1350,1352,1355,1357,1359,1361,1363,1365,1367,1369,1371,1373,1375],{"class":202,"line":1349},100,[136,1351,1198],{"class":209},[136,1353,1354],{"class":287}," \"Could not deprovision ",[136,1356,326],{"class":213},[136,1358,595],{"class":287},[136,1360,1333],{"class":206},[136,1362,1063],{"class":287},[136,1364,1212],{"class":287},[136,1366,326],{"class":213},[136,1368,595],{"class":287},[136,1370,278],{"class":209},[136,1372,1221],{"class":206},[136,1374,1063],{"class":287},[136,1376,1181],{"class":287},[136,1378,1380],{"class":202,"line":1379},101,[136,1381,924],{"class":206},[136,1383,1385],{"class":202,"line":1384},102,[136,1386,930],{"class":206},[136,1388,1390],{"class":202,"line":1389},103,[136,1391,950],{"class":206},[136,1393,1395],{"class":202,"line":1394},104,[136,1396,569],{"emptyLinePlaceholder":568},[136,1398,1400],{"class":202,"line":1399},105,[136,1401,1402],{"class":373},"# Consumer experiences and Windows tips (honored on Enterprise and Education only).\n",[136,1404,1406,1409,1411],{"class":202,"line":1405},106,[136,1407,1408],{"class":206},"$cloudContentPath ",[136,1410,642],{"class":213},[136,1412,1413],{"class":287}," \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\CloudContent\"\n",[136,1415,1417,1420,1422,1424,1427,1429,1432],{"class":202,"line":1416},107,[136,1418,1419],{"class":213},"if",[136,1421,1118],{"class":206},[136,1423,1121],{"class":209},[136,1425,1426],{"class":206},".ShouldProcess($cloudContentPath",[136,1428,304],{"class":213},[136,1430,1431],{"class":287}," \"Set consumer experience policies\"",[136,1433,1132],{"class":206},[136,1435,1437,1440,1442,1445,1447,1450,1452],{"class":202,"line":1436},108,[136,1438,1439],{"class":209},"    New-Item",[136,1441,214],{"class":213},[136,1443,1444],{"class":206},"Path $cloudContentPath ",[136,1446,995],{"class":213},[136,1448,1449],{"class":206},"Force ",[136,1451,269],{"class":213},[136,1453,1318],{"class":209},[136,1455,1457,1460,1462,1464,1466,1468,1471,1473,1476,1479,1481,1484,1486,1488,1490],{"class":202,"line":1456},109,[136,1458,1459],{"class":209},"    New-ItemProperty",[136,1461,214],{"class":213},[136,1463,1444],{"class":206},[136,1465,995],{"class":213},[136,1467,987],{"class":206},[136,1469,1470],{"class":287},"\"DisableWindowsConsumerFeatures\"",[136,1472,214],{"class":213},[136,1474,1475],{"class":206},"Value ",[136,1477,1478],{"class":209},"1",[136,1480,214],{"class":213},[136,1482,1483],{"class":206},"PropertyType DWord ",[136,1485,995],{"class":213},[136,1487,1449],{"class":206},[136,1489,269],{"class":213},[136,1491,1318],{"class":209},[136,1493,1495,1497,1499,1501,1503,1505,1508,1510,1512,1514,1516,1518,1520,1522,1524],{"class":202,"line":1494},110,[136,1496,1459],{"class":209},[136,1498,214],{"class":213},[136,1500,1444],{"class":206},[136,1502,995],{"class":213},[136,1504,987],{"class":206},[136,1506,1507],{"class":287},"\"DisableSoftLanding\"",[136,1509,214],{"class":213},[136,1511,1475],{"class":206},[136,1513,1478],{"class":209},[136,1515,214],{"class":213},[136,1517,1483],{"class":206},[136,1519,995],{"class":213},[136,1521,1449],{"class":206},[136,1523,269],{"class":213},[136,1525,1318],{"class":209},[136,1527,1529],{"class":202,"line":1528},111,[136,1530,950],{"class":206},[136,1532,1534],{"class":202,"line":1533},112,[136,1535,569],{"emptyLinePlaceholder":568},[136,1537,1539],{"class":202,"line":1538},113,[136,1540,1541],{"class":373},"# Widgets (\"Allow widgets\" policy, NewsAndInterests.admx).\n",[136,1543,1545,1548,1550],{"class":202,"line":1544},114,[136,1546,1547],{"class":206},"$dshPath ",[136,1549,642],{"class":213},[136,1551,1552],{"class":287}," \"HKLM:\\SOFTWARE\\Policies\\Microsoft\\Dsh\"\n",[136,1554,1556,1558,1560,1562,1565,1567,1570],{"class":202,"line":1555},115,[136,1557,1419],{"class":213},[136,1559,1118],{"class":206},[136,1561,1121],{"class":209},[136,1563,1564],{"class":206},".ShouldProcess($dshPath",[136,1566,304],{"class":213},[136,1568,1569],{"class":287}," \"Disable Widgets (AllowNewsAndInterests = 0)\"",[136,1571,1132],{"class":206},[136,1573,1575,1577,1579,1582,1584,1586,1588],{"class":202,"line":1574},116,[136,1576,1439],{"class":209},[136,1578,214],{"class":213},[136,1580,1581],{"class":206},"Path $dshPath ",[136,1583,995],{"class":213},[136,1585,1449],{"class":206},[136,1587,269],{"class":213},[136,1589,1318],{"class":209},[136,1591,1593,1595,1597,1599,1601,1603,1606,1608,1610,1613,1615,1617,1619,1621,1623],{"class":202,"line":1592},117,[136,1594,1459],{"class":209},[136,1596,214],{"class":213},[136,1598,1581],{"class":206},[136,1600,995],{"class":213},[136,1602,987],{"class":206},[136,1604,1605],{"class":287},"\"AllowNewsAndInterests\"",[136,1607,214],{"class":213},[136,1609,1475],{"class":206},[136,1611,1612],{"class":209},"0",[136,1614,214],{"class":213},[136,1616,1483],{"class":206},[136,1618,995],{"class":213},[136,1620,1449],{"class":206},[136,1622,269],{"class":213},[136,1624,1318],{"class":209},[136,1626,1628],{"class":202,"line":1627},118,[136,1629,950],{"class":206},[136,1631,1633],{"class":202,"line":1632},119,[136,1634,569],{"emptyLinePlaceholder":568},[136,1636,1638,1640,1642,1645],{"class":202,"line":1637},120,[136,1639,1419],{"class":213},[136,1641,1118],{"class":206},[136,1643,1644],{"class":213},"-not",[136,1646,1647],{"class":206}," $KeepOneDrive) {\n",[136,1649,1651],{"class":202,"line":1650},121,[136,1652,1653],{"class":373},"    # New profiles run OneDrive setup from a Run value in the Default user hive.\n",[136,1655,1657,1660,1662,1664,1666,1668,1671],{"class":202,"line":1656},122,[136,1658,1659],{"class":206},"    $defaultHive ",[136,1661,642],{"class":213},[136,1663,323],{"class":287},[136,1665,326],{"class":206},[136,1667,329],{"class":209},[136,1669,1670],{"class":206},"SystemDrive",[136,1672,1673],{"class":287},"\\Users\\Default\\NTUSER.DAT\"\n",[136,1675,1677,1680,1682],{"class":202,"line":1676},123,[136,1678,1679],{"class":206},"    $mountKey ",[136,1681,642],{"class":213},[136,1683,1684],{"class":287}," \"HKU\\DefaultUserTemp\"\n",[136,1686,1688,1691,1693],{"class":202,"line":1687},124,[136,1689,1690],{"class":206},"    $runKey ",[136,1692,642],{"class":213},[136,1694,1695],{"class":287}," \"Registry::HKEY_USERS\\DefaultUserTemp\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\"\n",[136,1697,1699],{"class":202,"line":1698},125,[136,1700,569],{"emptyLinePlaceholder":568},[136,1702,1704,1706,1709,1712,1714,1717,1720,1723,1726,1728,1731],{"class":202,"line":1703},126,[136,1705,1115],{"class":213},[136,1707,1708],{"class":206}," ((",[136,1710,1711],{"class":209},"Test-Path",[136,1713,214],{"class":213},[136,1715,1716],{"class":206},"Path $defaultHive) ",[136,1718,1719],{"class":213},"-and",[136,1721,1722],{"class":209}," $PSCmdlet",[136,1724,1725],{"class":206},".ShouldProcess($defaultHive",[136,1727,304],{"class":213},[136,1729,1730],{"class":287}," \"Remove OneDriveSetup Run value from the Default user hive\"",[136,1732,1132],{"class":206},[136,1734,1736,1739,1742,1745,1747],{"class":202,"line":1735},127,[136,1737,1738],{"class":213},"        &",[136,1740,1741],{"class":209}," reg.exe",[136,1743,1744],{"class":206}," load $mountKey $defaultHive ",[136,1746,269],{"class":213},[136,1748,1318],{"class":209},[136,1750,1752],{"class":202,"line":1751},128,[136,1753,569],{"emptyLinePlaceholder":568},[136,1755,1757,1759],{"class":202,"line":1756},129,[136,1758,1138],{"class":213},[136,1760,837],{"class":206},[136,1762,1764,1767,1769,1772,1774,1777,1779,1781,1784,1786],{"class":202,"line":1763},130,[136,1765,1766],{"class":213},"            if",[136,1768,1118],{"class":206},[136,1770,1771],{"class":209},"Get-ItemProperty",[136,1773,214],{"class":213},[136,1775,1776],{"class":206},"Path $runKey ",[136,1778,995],{"class":213},[136,1780,987],{"class":206},[136,1782,1783],{"class":287},"\"OneDriveSetup\"",[136,1785,214],{"class":213},[136,1787,1788],{"class":206},"ErrorAction SilentlyContinue) {\n",[136,1790,1792,1795,1797,1799,1801,1803],{"class":202,"line":1791},131,[136,1793,1794],{"class":209},"                Remove-ItemProperty",[136,1796,214],{"class":213},[136,1798,1776],{"class":206},[136,1800,995],{"class":213},[136,1802,987],{"class":206},[136,1804,1805],{"class":287},"\"OneDriveSetup\"\n",[136,1807,1809,1812],{"class":202,"line":1808},132,[136,1810,1811],{"class":209},"                Write-Host",[136,1813,1814],{"class":287}," \"Removed OneDriveSetup from the Default user Run key.\"\n",[136,1816,1818,1821,1824],{"class":202,"line":1817},133,[136,1819,1820],{"class":206},"            } ",[136,1822,1823],{"class":213},"else",[136,1825,837],{"class":206},[136,1827,1829,1831],{"class":202,"line":1828},134,[136,1830,1811],{"class":209},[136,1832,1833],{"class":287}," \"No OneDriveSetup value in the Default user Run key.\"\n",[136,1835,1837],{"class":202,"line":1836},135,[136,1838,1839],{"class":206},"            }\n",[136,1841,1843,1845,1848],{"class":202,"line":1842},136,[136,1844,1187],{"class":206},[136,1846,1847],{"class":213},"finally",[136,1849,837],{"class":206},[136,1851,1853],{"class":202,"line":1852},137,[136,1854,1855],{"class":373},"            # Release any handles PowerShell holds on the hive before unloading it.\n",[136,1857,1859,1862,1865],{"class":202,"line":1858},138,[136,1860,1861],{"class":206},"            [",[136,1863,1864],{"class":213},"gc",[136,1866,1867],{"class":206},"]::Collect()\n",[136,1869,1871,1873,1875],{"class":202,"line":1870},139,[136,1872,1861],{"class":206},[136,1874,1864],{"class":213},[136,1876,1877],{"class":206},"]::WaitForPendingFinalizers()\n",[136,1879,1881,1884,1886,1889],{"class":202,"line":1880},140,[136,1882,1883],{"class":209},"            Start-Sleep",[136,1885,214],{"class":213},[136,1887,1888],{"class":206},"Seconds ",[136,1890,1891],{"class":209},"1\n",[136,1893,1895,1898,1900,1903,1905],{"class":202,"line":1894},141,[136,1896,1897],{"class":213},"            &",[136,1899,1741],{"class":209},[136,1901,1902],{"class":206}," unload $mountKey ",[136,1904,269],{"class":213},[136,1906,1318],{"class":209},[136,1908,1910],{"class":202,"line":1909},142,[136,1911,924],{"class":206},[136,1913,1915],{"class":202,"line":1914},143,[136,1916,930],{"class":206},[136,1918,1920],{"class":202,"line":1919},144,[136,1921,950],{"class":206},[136,1923,1925],{"class":202,"line":1924},145,[136,1926,569],{"emptyLinePlaceholder":568},[136,1928,1930,1932],{"class":202,"line":1929},146,[136,1931,1050],{"class":209},[136,1933,1934],{"class":287}," \"Done. Verify with Get-AppxPackage -AllUsers, then run Sysprep \u002Fgeneralize.\"\n",[47,1936,1938],{"id":1937},"notes","Notes",[52,1940,1941,1948,1977,1983,1992,1999,2012],{},[55,1942,1943,1944,1947],{},"Snapshot the reference VM before running this. The patterns are wildcards, and a pattern that's too broad will remove more than you intended. Run ",[23,1945,1946],{},"Get-AppxProvisionedPackage -Online | Format-Table DisplayName, PackageName"," (the command Microsoft's app overview uses) first to see exactly what your build provisions.",[55,1949,1950,1951,61,1954,1957,1958,1961,1962,1965,1966,1968,1969,1972,1973,1976],{},"If Sysprep still fails, open ",[23,1952,1953],{},"setupact.log",[23,1955,1956],{},"setuperr.log"," in ",[23,1959,1960],{},"%WINDIR%\\System32\\Sysprep\\Panther"," and search for ",[23,1963,1964],{},"SYSPRP Package",". Copy them somewhere else before retrying: Microsoft's \"fatal error occurred while trying to sysprep\" article notes that each Sysprep run clears that ",[23,1967,1953],{},". The line names the exact ",[23,1970,1971],{},"PackageFullName"," that's installed for a user but no longer provisioned. Remove it with ",[23,1974,1975],{},"Remove-AppxPackage -Package \u003CPackageFullName>"," for that user (or delete the extra test account) and rerun.",[55,1978,1979,1980,1982],{},"Microsoft's article also calls out the reverse trap: letting the Store update an inbox app during image prep produces the same ",[23,1981,33],{}," failure. Keep the reference VM offline between patching and capture.",[55,1984,1985,1988,1989,71],{},[23,1986,1987],{},"reg.exe unload"," fails if anything still holds a handle on the mounted hive. The script forces garbage collection first; if it still fails interactively, close any Registry Editor windows and rerun ",[23,1990,1991],{},"reg.exe unload HKU\\DefaultUserTemp",[55,1993,1994,1995,1998],{},"Removing the ",[23,1996,1997],{},"OneDriveSetup"," Run value is a community-documented technique (it appears in the archived Microsoft TechNet forums rather than in product documentation), so verify first sign-in behavior on your build after capture. It only stops the per-user setup from launching; it doesn't block OneDrive by policy.",[55,2000,2001,2002,2006,2007,71],{},"On Windows 11 24H2 and later Enterprise or Education, the ",[2003,2004,2005],"strong",{},"Remove default Microsoft Store packages from the system"," policy does this removal natively at OOBE and first sign-in, and blocks reinstallation while the app stays selected. If you can use it, it's more durable than baking removals into an image. I cover it in the ",[2008,2009,2011],"a",{"href":2010},"\u002F2025\u002F11\u002F05\u002Fpowershell-windows-11-strip-preinstalled-apps-from-a-deployment-image\u002F","deployment image companion post",[55,2013,2014],{},"A feature update can reintroduce inbox apps on the reference image. Rerun this after any feature update and recapture.",[47,2016,2018],{"id":2017},"source","Source",[52,2020,2021,2029,2035,2041,2048,2055,2062,2069],{},[55,2022,2023],{},[2008,2024,2028],{"href":2025,"rel":2026},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Ftroubleshoot\u002Fwindows-client\u002Fsetup-upgrade-and-drivers\u002Fsysprep-fails-remove-or-update-store-apps",[2027],"nofollow","Sysprep fails with Microsoft Store apps (KB 2769827)",[55,2030,2031],{},[2008,2032,44],{"href":2033,"rel":2034},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fpowershell\u002Fmodule\u002Fdism\u002Fremove-appxprovisionedpackage",[2027],[55,2036,2037],{},[2008,2038,37],{"href":2039,"rel":2040},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fpowershell\u002Fmodule\u002Fappx\u002Fremove-appxpackage",[2027],[55,2042,2043],{},[2008,2044,2047],{"href":2045,"rel":2046},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fwindows-hardware\u002Fmanufacture\u002Fdesktop\u002Fsysprep-command-line-options",[2027],"Sysprep command-line options",[55,2049,2050],{},[2008,2051,2054],{"href":2052,"rel":2053},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Ftroubleshoot\u002Fwindows-client\u002Fsetup-upgrade-and-drivers\u002Ffatal-error-occurred-sysprep-machine",[2027],"A fatal error occurred while trying to sysprep the machine",[55,2056,2057],{},[2008,2058,2061],{"href":2059,"rel":2060},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fwindows\u002Fclient-management\u002Fmdm\u002Fpolicy-csp-experience",[2027],"Experience Policy CSP (AllowWindowsConsumerFeatures, AllowWindowsTips)",[55,2063,2064],{},[2008,2065,2068],{"href":2066,"rel":2067},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fwindows\u002Fclient-management\u002Fmdm\u002Fpolicy-csp-newsandinterests",[2027],"NewsAndInterests Policy CSP (AllowNewsAndInterests)",[55,2070,2071],{},[2008,2072,2075],{"href":2073,"rel":2074},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Farchive\u002Fmsdn-technet-forums\u002F55fc0687-77ba-4108-aaff-dcf11769c4f7",[2027],"Uninstall OneDrive during a Windows 10 OSD task sequence (archived TechNet thread)",[2077,2078,2079],"style",{},"html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}",{"title":197,"searchDepth":377,"depth":377,"links":2081},[2082,2083,2084,2085,2086,2087],{"id":49,"depth":377,"text":50},{"id":97,"depth":377,"text":98},{"id":186,"depth":377,"text":187},{"id":362,"depth":377,"text":363},{"id":1937,"depth":377,"text":1938},{"id":2017,"depth":377,"text":2018},"techcolumnist",[2090,2091],"ps","scripts","2025-07-16T14:00:00Z","A PowerShell script that removes consumer AppX packages for all users and from provisioning, sets consumer-experience policies, and keeps Sysprep from failing.","md",false,null,{},"\u002Fblog\u002F2025\u002F07\u002F16\u002Fpowershell-windows-11-debloat-a-golden-image-before-sysprep",{"title":6,"description":2093},[2088],"blog\u002F2025\u002F07\u002F16\u002Fpowershell-windows-11-debloat-a-golden-image-before-sysprep",[196,2103,2104],"windows-11","debloat","\u002F2025\u002F07\u002F16\u002Fpowershell-windows-11-debloat-a-golden-image-before-sysprep\u002F","uBovfDr3TuNTGxRCJsrr4mc88Wx7PEV2HuB2XjvXYPU",{"title":2108,"description":2109,"date":2110,"url":2111,"categories":2112,"tags":2114,"image":2115,"readingTime":417,"canonical":2116,"sites":2117,"series":2118,"seriesOrder":429},"Service Portfolios & Productization: Defining, marketing, and managing IT services","Ten weeks of rethinking IT not as a cost center, but as a strategic driver.","2025-07-28T23:49:15Z","\u002F2025\u002F07\u002F28\u002Fservice-portfolios-productization-defining-marketing-and-managing-it-services\u002F",[2113],"business",[],"\u002Fuploads\u002F2025\u002F07\u002FChatGPT-Image-Jul-28-2025-07_40_34-PM.png","lasswell",[2116,2088],"itsm-in-practice",{"title":2120,"description":2121,"date":2122,"url":2123,"categories":2124,"tags":2125,"image":2096,"readingTime":397,"canonical":2088,"sites":2128,"series":2096,"seriesOrder":2096},"PowerShell: Hyper-V – Script a Failover Cluster Deployment End to End","A re-runnable script that installs Hyper-V and clustering, validates the nodes, builds the cluster, sets a quorum witness, adds CSV or S2D storage and pins Live Migration.","2025-07-09T14:00:00Z","\u002F2025\u002F07\u002F09\u002Fpowershell-hyper-v-script-a-failover-cluster-deployment-end-to-end\u002F",[2090,2091],[196,2126,2127],"hyper-v","cluster",[2088],[2130,2139,2149],{"title":2131,"description":2132,"date":2133,"url":2010,"categories":2134,"tags":2135,"image":2096,"readingTime":397,"canonical":2088,"sites":2138,"series":2096,"seriesOrder":2096},"PowerShell: Windows 11 – Strip Preinstalled Apps from an Image","A PowerShell script that removes provisioned apps from a mounted Windows 11 WIM or a running system, plus the Windows 11 24H2+ policy that does it natively.","2025-11-05T14:00:00Z",[2090,2091],[196,2103,2104,2136,2137],"gpo","intune",[2088],{"title":2140,"description":2141,"date":2142,"url":2143,"categories":2144,"tags":2145,"image":2096,"readingTime":397,"canonical":2088,"sites":2148,"series":2096,"seriesOrder":2096},"PowerShell: Active Directory – Report Group Membership Sprawl","Rank AD security groups by nesting depth, transitive member count, ownership and staleness for an access review, plus a per-user Kerberos token size estimate.","2025-12-03T14:00:00Z","\u002F2025\u002F12\u002F03\u002Fpowershell-active-directory-report-group-membership-sprawl\u002F",[2090,2091],[196,2146,2147],"active-directory","reporting",[2088],{"title":2150,"description":2151,"date":2152,"url":2153,"categories":2154,"tags":2155,"image":2096,"readingTime":391,"canonical":2088,"sites":2157,"series":2096,"seriesOrder":2096},"PowerShell: Windows Server – Disable SMBv1 Fleet-Wide and Verify","A script that audits SMBv1 access (event 3000), disables the SMBv1 server and optional feature across Windows servers, and reports which ones still need a restart.","2025-11-26T14:00:00Z","\u002F2025\u002F11\u002F26\u002Fpowershell-windows-server-disable-smbv1-fleet-wide-and-verify-it-stuck\u002F",[2090,2091],[196,2156],"windows",[2088],{"doc":2096,"posts":2159},[],1790052513081]