Forum Discussion
leonmoodley
May 16, 2024Tin Contributor
Unable to suppress confirmation popups in Powershell for Format-volume and Remove-Partition
Hi I use the script below to format a secondary drive, I am using the script below ( it basically checks for the required disk size and attempts to format it. If the disk exists already the parti...
- May 20, 2024
For some reason if I run
Stop-Service -Name ShellHWDetection
This seems to have fixed the issue, I start the service again when the rest of the code finishes. Thanks for the assistance. Much appreciated
leonmoodley
May 20, 2024Tin Contributor
Harm_Veenstra Many thanks for your assistance Harm
The code works fantastically and completes the format etc, It seems that when the new partition is created the Format Prompt pops up. The script does what it is supposed to do, but unfortunately this Pop Up still appears. I'll keep investigating and see if I can figure out whats causing it.
May 20, 2024
I didn't get that message during testing in my VM... Weird... Could you try disabling automount temporarily using this article for testing? https://www.tenforums.com/tutorials/117336-enable-disable-automount-new-disks-drives-windows.html
- leonmoodleyMay 20, 2024Tin Contributor
For some reason if I run
Stop-Service -Name ShellHWDetection
This seems to have fixed the issue, I start the service again when the rest of the code finishes. Thanks for the assistance. Much appreciated- May 20, 2024Ah 👍 nice find!
- leonmoodleyMay 20, 2024Tin Contributor
Hi Harm
I have tested with automount disabled but still the same result. I can confirm though that the command below
$DD | New-Partition -UseMaximumSize -DriveLetter d -ErrorAction Stop | Out-Nullis the one which triggers the POP up message for some weird reason.
This also seems to be the case when the script runs again and finds a partition, The Remove partion command also triggers the pop up.
Once again many thanks for your help