Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
2 answers
4k views

How to create a EFI partition using PowerShell?

I would like to automate a script that creates an EFI partition. Currently, one step is manual and requires to start DISKPART and execute these commands: create partition efi size=100 format fs=...
SuperJMN's user avatar
  • 181
1 vote
1 answer
2k views

0xC03A001B error while trying to compact VHD

What can be the reason of such error? I tried to compact both via DISKPART and Optimize-Vhd commandlet. Via DISKPART I get following error: DISKPART> compact vdisk DiskPart has encountered an ...
Suncatcher's user avatar
3 votes
2 answers
4k views

Format disk with diskpart if not formatted

I'm trying to write a script to create and format a partition in Windows Server 2008R2. Now, when disk 1 is selected, I need to format it, only if it is not formatted already. This is what I have ...
ccamacho's user avatar
  • 213
4 votes
1 answer
1k views

Diskpart breaking drive letters after powershell script is run

I built a script that mounts (attach) a VHD using Diskpart, cleans out some system files and then unmounts (detach) it. It uses a foreach loop and is suppose to clean multiple VHD using the same drive ...
Kyle's user avatar
  • 121
8 votes
2 answers
2k views

Using Diskpart in a PowerShell script won't allow script to reuse drive letter

I built a script that mounts (attach) a VHD using Diskpart, cleans out some system files and then unmounts (detach) it. It uses a foreach loop and is suppose to clean multiple VHD using the same ...
Kyle's user avatar
  • 121