OSDCloud does not handle OEM partitions during the disk wipe phase
we solved this using the following function - HP is called out in the popup prompt that we are exposing to our Desktop Techs as we are primarily a HP shop, but this handles all OEM and their partition settings.
#Starting the Custom Gui
$parts = (Get-Partition | Select-Object type,isboot,nodefaultdriveletter)
$showPrompt = $false
foreach ($part in $parts) {
if ($part.type -ieq 'basic' -and !$part.isboot -and $part.nodefaultdriveletter) {
$showPrompt = $true
}
}
if ($showPrompt) {
Add-Type -AssemblyName PresentationCore, PresentationFramework
$response = [system.windows.messagebox]::show('An HP OEM partition has been detected on this device. This can sometimes prevent OSDCloud from properly cleaning the drive before reinstalling Windows. Press Yes below to pre-wipe the drive to circumvent this issue.
Do you want to pre-wipe the internal hard drive?', 'OEM Partition detected!', 'yesno')
if ($response -eq 'Yes') {
Write-Host 'Wiping the internal drive'
Set-DriveCleanup
Write-Host 'Internal Drive Successfully'
} else {
Write-Host 'Not wiping drive'
}
}
here is the Set-DriveCleanup function for review: