How can I script updates for the system reserved partition in Windows 11?

0
1
Asked By TechGuru42 On

I've seen quite a few users struggling to update to Windows 11 through the update ring in Intune due to the error 'unable to update system reserved partition.' I've managed to manually run a series of commands as an administrator on two devices, but I'm looking for guidance on how to automate this process via a script push in Intune for those affected devices. Any suggestions would be greatly appreciated!

3 Answers

Answered By CodeMaster88 On

Here's a complete script example that might work for you:
```powershell
$fontsPath = "Z:EFIMicrosoftBootFonts"

# Mount EFI partition
$diskpartScript = @"
select disk 0
select partition 1
assign letter=Z
exit
"@

$scriptPath = "$env:TEMPdp_detect.txt"
$diskpartScript | Set-Content -Path $scriptPath -Encoding ASCII

Start-Process -FilePath "diskpart.exe" -ArgumentList "/s `"$scriptPath`"" -Wait -NoNewWindow
Start-Sleep -Seconds 2

# Check for font files
if (Test-Path $fontsPath -and (Get-ChildItem $fontsPath -File)) {
Write-Output "Font files exist. Remediation needed."
exit 1
} else {
Write-Output "No font files found. No remediation needed."
exit 0
}
```
This script mounts the EFI partition and checks for font files. If they’re found, remediation is needed!

Answered By PowershellPro101 On

For disk management, PowerShell has its own set of commands that you can use, which can be simpler than Diskpart. Here's a quick example of how to manage partitions safely:
```
Add-PartitionAccessPath -DiskNumber 0 -PartitionNumber 1 -AccessPath Z:
```
But make sure to find the actual system partition programmatically—don't assume Disk 0 and Partition 1 are always the right choice! You can use:
```
Get-Partition | Where-Object -Property IsSystem -EQ $true
```
This will help avoid risks of using the wrong partition!

TechGuru42 -

Thanks for the tip! I'll definitely use this safer approach.

Answered By ScriptingNinja99 On

You can use the `/s` parameter in Diskpart to execute a script file directly. The commands you've written can be easily translated. To get started, here’s a sample of how you can set it up:
```
@(
"List disk"
"sel disk 0"
"list part"
"sel part 1"
"assign letter=z"
) | diskpart.exe
```
This way, you’re sending commands to Diskpart as if you were typing them out manually!

CuriousDev22 -

I’m not too familiar with PowerShell. Can you help with translating those commands into a PowerShell script?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.