見出し画像

Win11でSysprepをやってみた


2023/10/18 「それでもエラーが出る場合」を追記



再起動とOOBEが起動するので毎度気が重い作業であるSysprep
今回試してみたのでここに残す

下記でインストールしたイメージにSysprepをあってみた。


まずはデフォルトでやってみよう。

Sysprepは毎度何かエラーが出るのだが、今回は試しに何もせずやってみる。

予想通りエラー発生したので解消する。

以下のエラーが発生
「SysprepでWindowsのインストールを検証できませんでした。詳細については、%WINDIR%\System32\Sysprep\Panther\setupact.logにあるログ ファイルを書くインしてください。問題を解決してから、Sysprepを使用してインストールを再度検証してください。」

記載のログの中を見てみる。たいていはInfoだけどError、Warningになっているものだけを以下に抽出してみた。

Warning               SYSPRP WinMain: File operations pending
Error                 SYSPRP Package Microsoft.LanguageExperiencePackja-JP_22621.20.103.0_neutral__8wekyb3d8bbwe was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
Error                 SYSPRP Failed to remove apps for the current user: 0x80073cf2.
Error                 SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.
Error                 SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'SysprepGeneralizeValidate' from C:\Windows\System32\AppxSysprep.dll; dwRet = 0x3cf2
Error                 SYSPRP SysprepSession::Validate: Error in validating actions from C:\Windows\System32\Sysprep\ActionFiles\Generalize.xml; dwRet = 0x3cf2
Error                 SYSPRP RunPlatformActions:Failed while validating Sysprep session actions; dwRet = 0x3cf2
Error      [0x0f0070] SYSPRP RunDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2
Error      [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2

上記のうち、以下に注目

Error                 SYSPRP Package Microsoft.LanguageExperiencePackja-JP_22621.20.103.0_neutral__8wekyb3d8bbwe was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
Error                 SYSPRP Failed to remove apps for the current user: 0x80073cf2.

Sysprepはストアアプリと干渉してエラーが発生する。
今回のエラーの場合、Microsoft.LanguageExperiencePackja-JPを抜く必要がある。
抜き方としては管理者権限でPowerShellを起動し、以下を実行

Get-AppxPackage -AllUsers Microsoft.LanguageExperiencePackja-JP* | Remove-AppxPackage -AllUsers

他にはどんなものがあるのか見てみる。
コマンドとしては以下

Get-AppxProvisionedPackage -Online | Format-Table DisplayName

結果、出てきたのは以下

Clipchamp.Clipchamp
Microsoft.549981C3F5F10
Microsoft.BingNews
Microsoft.BingWeather
Microsoft.DesktopAppInstaller
Microsoft.GamingApp
Microsoft.GetHelp
Microsoft.Getstarted
Microsoft.HEIFImageExtension
Microsoft.HEVCVideoExtension
Microsoft.MicrosoftEdge.Stable
Microsoft.MicrosoftOfficeHub
Microsoft.MicrosoftSolitaireCollection
Microsoft.MicrosoftStickyNotes
Microsoft.Paint
Microsoft.People
Microsoft.PowerAutomateDesktop
Microsoft.RawImageExtension
Microsoft.ScreenSketch
Microsoft.SecHealthUI
Microsoft.StorePurchaseApp
Microsoft.Todos
Microsoft.VCLibs.140.00
Microsoft.VP9VideoExtensions
Microsoft.WebMediaExtensions
Microsoft.WebpImageExtension
Microsoft.Windows.Photos
Microsoft.WindowsAlarms
Microsoft.WindowsCalculator
Microsoft.WindowsCamera
microsoft.windowscommunicationsapps
Microsoft.WindowsFeedbackHub
Microsoft.WindowsMaps
Microsoft.WindowsNotepad
Microsoft.WindowsSoundRecorder
Microsoft.WindowsStore
Microsoft.WindowsTerminal
Microsoft.Xbox.TCUI
Microsoft.XboxGameOverlay
Microsoft.XboxGamingOverlay
Microsoft.XboxIdentityProvider
Microsoft.XboxSpeechToTextOverlay
Microsoft.YourPhone
Microsoft.ZuneMusic
Microsoft.ZuneVideo
MicrosoftCorporationII.QuickAssist
MicrosoftTeams
MicrosoftWindows.Client.WebExperience

上記のうち、必要がないものだけを以下の2種類のPowershellコマンドで抜いていく。

Get-AppxPackage -AllUsers "アプリ名" | Remove-AppxPackage
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "アプリ名" | Remove-AppxProvisionedPackage -Online

私が消したのは以下コマンドの末尾に「#説明文」を付けている。

Get-AppxPackage -AllUsers Microsoft.BingNews | Remove-AppxPackage #bingNews
Get-AppxPackage -AllUsers Microsoft.BingWeather | Remove-AppxPackage #bing天気
Get-AppxPackage -AllUsers Microsoft.MicrosoftSolitaireCollection | Remove-AppxPackage #ソリティア
Get-AppxPackage -AllUsers GetHelp | Remove-AppxPackage #ヘルプを表示する
Get-AppxPackage -AllUsers Microsoft.Getstarted | Remove-AppxPackage #Microsoft のヒント
Get-AppxPackage -AllUsers Microsoft.MicrosoftOfficeHub | Remove-AppxPackage #Office
Get-AppxPackage -AllUsers Microsoft.People | Remove-AppxPackage #Microsoft People
Get-AppxPackage -AllUsers Microsoft.Todos | Remove-AppxPackage #Microsoft Todo
Get-AppxPackage -AllUsers microsoft.windowscommunicationsapps| Remove-AppxPackage #メール
Get-AppxPackage -AllUsers Microsoft.YourPhone| Remove-AppxPackage #スマートフォン
Get-AppxPackage -AllUsers Microsoft.ZuneMusic| Remove-AppxPackage #Groove ミュージック
Get-AppxPackage -AllUsers Microsoft.ZuneVideo| Remove-AppxPackage #映画 & テレビ
Get-AppxPackage -AllUsers MicrosoftCorporationII.QuickAssist| Remove-AppxPackage #クイックアシスト
Get-AppxPackage -AllUsers MicrosoftTeams| Remove#-AppxPackage #MicrosoftTeams
#上記だけでは復活するらしいので別の方法でも消す
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "Microsoft.BingNews" | Remove-AppxProvisionedPackage -Online #bingNews
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "Microsoft.BingWeather" | Remove-AppxProvisionedPackage -Online #bing天気
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "Microsoft.MicrosoftSolitaireCollection" | Remove-AppxProvisionedPackage -Online #ソリティア
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "GetHelp" | Remove-AppxProvisionedPackage -Online #ヘルプを表示する
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "Microsoft.Getstarted" | Remove-AppxProvisionedPackage -Online #Microsoft のヒント
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "Microsoft.MicrosoftOfficeHub" | Remove-AppxProvisionedPackage -Online #Office
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "Microsoft.People" | Remove-AppxProvisionedPackage -Online #Microsoft People
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "Microsoft.Todos" | Remove-AppxProvisionedPackage -Online #Microsoft Todo
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "microsoft.windowscommunicationsapps" | Remove-AppxProvisionedPackage -Online #メール
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "Microsoft.YourPhone" | Remove-AppxProvisionedPackage -Online #スマートフォン
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "Microsoft.ZuneMusic" | Remove-AppxProvisionedPackage -Online #Groove ミュージック
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "Microsoft.ZuneVideo" | Remove-AppxProvisionedPackage -Online #映画 & テレビ
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "MicrosoftCorporationII.QuickAssist" | Remove-AppxProvisionedPackage -Online #クイックアシスト
Get-AppxProvisionedPackage -Online | Where DisplayName -Like "MicrosoftTeams" | Remove-AppxProvisionedPackage -Online #MicrosoftTeams

それぞれ何かは、主に以下を参照すること

コマンドでも消えないアプリも消す

前記で消えないアプリが以下の赤枠。

右クリック、アンインストールで抜いていく。

以上を行った上で、改めてSysprepを適用して無事完了。

それでもエラーが出る場合

複数のユーザプロファイルがある場合にエラーになる場合があるので、ユーザプロファイルはSysprepをかけるユーザ以外は消しましょう。

Win10の記録は以下

イメージ化とは何ぞやは


この記事が気に入ったらサポートをしてみませんか?