OSDeploy / OSD

OSD Shared Functions
MIT License
151 stars 61 forks source link

Removal of the Driveletter C not working when bound to Cardreader #15

Open marcohald opened 3 years ago

marcohald commented 3 years ago

Describe the bug The Driveletter C was assigned to the empty Card reader and was not deletable via the line https://github.com/OSDeploy/OSD/blob/9bb7639c7381b0ef5c1dee9db1582be33f4a16c7/Public/Disk/New-OSDisk.ps1#L282 The Problem is that the Get-Volume CMDlet return a Object but it can't be consummed by the Get-Partition CMDlet The Partition for the OS was not created via Start-OSDCloud -ImageFileUrl $imageUrl -ZTI and the Recovery Partition was the Size of the Remaining Space

I tried to change the Driveletter via WMI but that didn't work either

$drive = Get-WmiObject -Class win32_volume -Filter “DriveLetter = ‘c:'”
Set-WmiInstance -input $drive -Arguments @{DriveLetter=”Q:”}

Expected behavior clear the letter assignment

Additional context As a workaround I have added the Line &mountvol C: /D to my script

OSDeploy commented 2 years ago

Thanks, I'll see how I can add a check for a C: Drive and remove it like I am doing with the USB Drive Letters. Can you run a Get-Volume for the Card Reader?

marcohald commented 2 years ago

At the moment i don't have access to a device with this problematic card reader. But as written before The Problem is that the Get-Volume CMDlet return a Object but it can't be consummed by the Get-Partition CMDlet As far as I can remember the mountvol.exe was the only way that can handle the cardreader without an inserted card

Vexxer1 commented 6 months ago

This issue has been around for ages in different OS deployment scenarios. :) Especially when the HDD/SSD is not partitioned. I just recently started trying out OSDCloud and just wanted to add my 2 cents on how we approached this: Get your hands on the 64-Bit Version of Devcon (might be a bit harder to find, but can be googled) and add: devcon.exe disable USBSTOR* and possibly devcon.exe disable CDROM To just disable the devices that can "steal" the C-Drive.