none
error creating efi partition with powershell RRS feed

  • Question

  • Hello. I have a problem when trying to create the partitions for installing windows 8 on a GPT disk. The error happens when trying to create the efi partition. The command that is in bold. The error reported is:

    Format-Volume : No matching MSFT_Volume objects found by CIM query for enumerating instances of the ROOT/Microsoft/Windows/Storage/MSFT_Volume class on the CIM server, that are associated with the following instance: MSFT_Partition (DiskId = "\\?\scsi#disk&ven_msft&prod_virtual_dis..., Offset = 315621376). Verify query parameters and retry. At line:1 char:111 + ... riveLetter S | Format-Volume -FileSystem FAT32 -NewFileSystemLabel System -Confi ... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Category :ObjectNotFound: (MSFT_Volume:String) [Format=Volume], CimJobException +FullyQualifiedErrorId: CmdletizationQuery_NotFound,Format-Volume



    powershell -noprofile "& {Clear-Disk 0 -RemoveData -RemoveOEM  -Confirm:$false}"
    powershell -noprofile "& {Initialize-Disk 0 -PartitionStyle GPT  -Confirm:$false}"
    powershell -noprofile "& {New-Partition -DiskNumber 0 -GptType '{de94bba4-06d1-4d40-a16a-bfd50179d6ac}' -Size 300MB -DriveLetter T | Format-Volume -FileSystem NTFS -NewFileSystemLabel WindowsRE -ShortFileNameSupport $False -Confirm:$false}"
    powershell -noprofile "& {New-Partition -DiskNumber 0 -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Size 100MB -DriveLetter S | Format-Volume -FileSystem FAT32 -NewFileSystemLabel System -Confirm:$false}"

    powershell -noprofile "& {New-Partition -DiskNumber 0 -GptType '{e3c9e316-0b5c-4db8-817d-f92df00215ae}' -Size 128MB}"
    powershell -noprofile "& {New-Partition -DiskNumber 0 -GptType '{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}' -%partsize-param% -DriveLetter C | Format-Volume -FileSystem NTFS -NewFileSystemLabel Windows -ShortFileNameSupport $False -Confirm:$false}"

    Does anyone know what is wrong with this command? Thank you


    • Edited by dann23 Sunday, December 22, 2013 4:38 PM
    Sunday, December 22, 2013 4:30 PM

Answers

  • I have been trying to find a disk I can sacrifice.  Everyone has an error of some kind when I try to et it up as an EFI boot disk.  THat means that I cannot exactly duplicate what you are doing.

    I do not really think it is a PowerShell issue since you can create and format all but the SYSTEM type partition.

    I cannot be much more help until I can find a trashable disk.

    Try posting in the MDT forum to see if anyone else has seen this.


    ¯\_(ツ)_/¯

    Monday, December 23, 2013 8:23 AM

All replies

  • Separate PowerShell commands on each line? That is a really slow and inefficient approach.

    It is much better to put the needed PowerShell commands in a script (.ps1 file) and just run the script.

    Bill

    Sunday, December 22, 2013 5:03 PM
    Moderator
  • I have almost 4000 lines of code in that bat file. I'm trying to convert it to powershell but it will take some time. Until then I can live with this inefficiency :)
    Sunday, December 22, 2013 5:23 PM
  • Consider running the commands interactively  at a PS prompt.  The error is saying that the volume you are referencing does not exist.  Ty and list all volumes that are defined to see where you mismatch is.


    ¯\_(ツ)_/¯

    Sunday, December 22, 2013 5:32 PM
  • I already tried to run interactively. Using powershell to list the volumes doesn't show the EFI partition. If I use diskpart I can see the EFI partition. It is created but it is in RAW format. It seems that powershell doesn't like EFI partitions.
    Sunday, December 22, 2013 6:01 PM
  • All MS documentation that I have seen says to use diskpart for UEFI.

    Are you running this on WIndows 8 or on PE?


    ¯\_(ツ)_/¯

    Sunday, December 22, 2013 6:12 PM
  • Windows PE
    Sunday, December 22, 2013 6:24 PM
  • Windows PE

    PE  5.0?


    ¯\_(ツ)_/¯

    Sunday, December 22, 2013 6:41 PM
  • You should probably be posting here: http://social.technet.microsoft.com/Forums/en-US/home?forum=mdt


    ¯\_(ツ)_/¯

    Sunday, December 22, 2013 6:50 PM
  • Yes. But I tried it in version 4.0 and I have the same error.
    Sunday, December 22, 2013 6:51 PM
  • Maybe but it seems it's a problem with powershell and EFI partitions.
    Sunday, December 22, 2013 6:52 PM
  • Maybe but it seems it's a problem with powershell and EFI partitions.

    No - its a problem with WMI/CIM and EFI partitions.  WMI is not part of PowerShell.  PE may not yet support That partition type which may be why all MS docs use DiskPart.

    Try the MDT forum as they would have more people who might have seen this.  PowerShell has little to do with the CIM error other than to report it.

    Also be sure you have all patches for CE 5.0 installed.


    ¯\_(ツ)_/¯

    Sunday, December 22, 2013 7:01 PM
  • Try this command as it may eek out a problem:

    New-Partition -DiskNumber 0 -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Size 100MB -AssignDriveLetter


    ¯\_(ツ)_/¯

    Sunday, December 22, 2013 7:07 PM
  • It doesn't work. Partition is created but not formatted. It's get the first free letter.

    I tried get-volume on a windows 8.1 client. It doesn't show efi volumes but diskpart does. So there are two possibilities. It's a bug or the syntax for creating is EFI partitions is wrong.

    It seems I'm not the only one with this problem.

    • Edited by dann23 Sunday, December 22, 2013 9:13 PM
    Sunday, December 22, 2013 9:10 PM
  • It doesn't work. Partition is created but not formatted. It's get the first free letter.

    I tried get-volume on a windows 8.1 client. It doesn't show efi volumes but diskpart does. So there are two possibilities. It's a bug or the syntax for creating is EFI partitions is wrong.

    It seems I'm not the only one with this problem.

    Right which shows yo how to get around the issue.  Create it then format then assign drive letter.


    ¯\_(ツ)_/¯

    Sunday, December 22, 2013 9:22 PM
  • Now try this method and see what happens:

    #requires -version 3.0
    #Create-GPTPartitionSet.ps1
    <# 
         call from batch or commandline:
         powershell -noprofile -file <filepath>\Create-GPTPartitionSet.ps1 -partsize 300Mb
    #>
    
    Param(
        $partsize=100Mb
    )
    Clear-Disk 0 -RemoveData -RemoveOEM  -Confirm:$false
    Initialize-Disk 0 -PartitionStyle GPT  -Confirm:$false
    New-Partition -DiskNumber 0 -GptType '{de94bba4-06d1-4d40-a16a-bfd50179d6ac}' -Size 300MB -DriveLetter T | 
          Format-Volume -FileSystem NTFS -NewFileSystemLabel WindowsRE -ShortFileNameSupport $False -Confirm:$false
    New-Partition -DiskNumber 0 -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Size 100MB -DriveLetter S | 
         Format-Volume -FileSystem FAT32 -NewFileSystemLabel System -Confirm:$false
    New-Partition -DiskNumber 0 -GptType '{e3c9e316-0b5c-4db8-817d-f92df00215ae}' -Size 128MB
    New-Partition -DiskNumber 0 -GptType '{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}' $partsize -DriveLetter C | 
         Format-Volume -FileSystem NTFS -NewFileSystemLabel Windows -ShortFileNameSupport $False -Confirm:$false
    
    

    Just place the single command line in your batch file. Test it at a command prompt first.


    ¯\_(ツ)_/¯

    Sunday, December 22, 2013 9:33 PM
  • That is the problem. How to select a partition that get-volume doesn't show?
    Sunday, December 22, 2013 9:39 PM
  • Try this too:  It will get you a drive letter that you want.

    New-Partition -DiskNumber 0 -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Size 100MB |
        Format-Volume -FileSystem FAT32 -NewFileSystemLabel System -Confirm:$false |
        Set-Partition -DriveLetter S


    ¯\_(ツ)_/¯

    Sunday, December 22, 2013 9:44 PM
  • Actually you may have to do it like this:

    New-Partition -DiskNumber 0 -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Size 100MB |
        Set-Partition -DriveLetter S |
        Format-Volume -FileSystem FAT32 -NewFileSystemLabel System -Confirm:$false

    One way or the other here will get you around the bug.


    ¯\_(ツ)_/¯

    Sunday, December 22, 2013 10:49 PM
  • None of the commands work. Set-partition: Parameter set cannot be resolved usig the specified named parameters.

    At line:3 char:5

    + Set-Partition - DriveLetter S

    Monday, December 23, 2013 6:04 AM
  • None of the commands work. Set-partition: Parameter set cannot be resolved usig the specified named parameters.

    At line:3 char:5

    + Set-Partition - DriveLetter S


    Post the exact code that caused that error.

    ¯\_(ツ)_/¯

    Monday, December 23, 2013 6:05 AM
  • Set-partition: Parameter set cannot be resolved usig the specified named parameters.

    At line:3 char:5

    + Set-Partition - DriveLetter S

    +~~~~~~~~~~~~~~~~~~

    +CategoryInfo: InvalidArgument: (:) [Set-Partition], ParameterBindingException

    +FullyQualifiedErrorId: AmbiguousParameterSet,Set-Partition

    Monday, December 23, 2013 6:09 AM
  • I need you to post the code you ran and not the error.

    ¯\_(ツ)_/¯

    Monday, December 23, 2013 6:11 AM
  • Both of your codes above give the same error. And the script that you posted earlier has the same error as I said in the first post.

    Also I tried to do this on clean install in Windows Server 2012 R2. I attached a second hard drive. I have the same error. So this rules out the possibility that my winpe is broken.


    • Edited by dann23 Monday, December 23, 2013 6:37 AM
    Monday, December 23, 2013 6:30 AM
  • I am ony asking you to post the exact lines you ran to get that error.  Not the lines I posted.  I need the lines you actually ran.

    I have reasons for asking this.


    ¯\_(ツ)_/¯

    Monday, December 23, 2013 6:41 AM
  • Monday, December 23, 2013 6:48 AM
  • Do you see what is happening?  The partition is not getting passed. 

    You need to do it the alternate way due to how the pipeline works.

    New-Partition -DiskNumber 0 -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Size 100MB |
        Set-Partition -DriveLetter S

    If that still won't work them we will need to find the new partition and set it individually.  There are at least two ways to do that.

    New-Partition -DiskNumber 0 -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Size 100MB -AssignDriveLetter |
         Set-Partition -NewDriveLetter S

    The problem seems to come from an odd bug in how that partition type is handled when it does not have a drive letter.  By forcing a drive letter we should be able to reassign it.  Once assigned you can use the drive letter to format it.


    ¯\_(ツ)_/¯

    Monday, December 23, 2013 6:58 AM
  • Still doesn't work. I tried both commands. The first gives an error and the second seems to be ok but it just creates the partition. No formatting and no drive letter.
    Monday, December 23, 2013 7:10 AM
  • You are still not doing what I asked.

    Clear the drive.  Run this command and then look at the partition table.

    New-Partition -DiskNumber 1 -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Size 100MB -AssignDriveLetter |
         Set-Partition -NewDriveLetter S

    Get-Partition -DiskNumber 1


    ¯\_(ツ)_/¯

    Monday, December 23, 2013 7:17 AM
  • I cleared the drive on every command. You can see in the screenshot. I can see the partition listed in powershell but not in diskpart. What should I do next?

    Monday, December 23, 2013 7:26 AM
  • Now just format the new volume by drive letter.

    Format-Volume -DriveLetter S


    ¯\_(ツ)_/¯

    Monday, December 23, 2013 7:32 AM
  • error again
    Monday, December 23, 2013 7:35 AM
  • By the way - you cannot install Windows on a FAT32 volume.  It is only good for compatible file storage between Mac or older Windows systems like Windows 98.


    ¯\_(ツ)_/¯

    Monday, December 23, 2013 7:35 AM
  • an EFI partition must be created for GPT disk.

    http://technet.microsoft.com/en-us/library/hh825686.aspx

    Monday, December 23, 2013 7:38 AM
  • an EFI partition must be created for GPT disk.

    http://technet.microsoft.com/en-us/library/hh825686.aspx

    Forget that for now.  I am trying to get you to do this in a single consistent way but so far you have managed to repeatedly throw in a subtle variation which ultimately screws up the diagnostic usefulness f the exercise.

    Close PowerSHell and start it new.

    Run these commands and only these commands exactly as posted her including all values.  COpy and past to the console.

    Clear-Disk 1 -RemoveData -RemoveOEM  -Confirm:$false
    Initialize-Disk 1 -PartitionStyle GPT  -Confirm:$false
    New-Partition -DiskNumber 1 -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Size 500MB -AssignDriveLetter

    Get-Partition -DiskNumber 1


    ¯\_(ツ)_/¯

    Monday, December 23, 2013 7:50 AM
  • Monday, December 23, 2013 7:57 AM
  • Now format it.  IF it doesn't format you may have a BIOS issue or a disk/controller issue.

    In that case you may be able to force it with DiskPart.


    ¯\_(ツ)_/¯

    Monday, December 23, 2013 8:02 AM
  • I doubt it. I tried it on Hyper-V, a laptop with windows 8.1 and an HP server. Maybe it's a bug with powershell cmdlets. The same command works for creating the recovery, msr and data partitions. Only EFI partition has this problem.

    Monday, December 23, 2013 8:06 AM
  • I have been trying to find a disk I can sacrifice.  Everyone has an error of some kind when I try to et it up as an EFI boot disk.  THat means that I cannot exactly duplicate what you are doing.

    I do not really think it is a PowerShell issue since you can create and format all but the SYSTEM type partition.

    I cannot be much more help until I can find a trashable disk.

    Try posting in the MDT forum to see if anyone else has seen this.


    ¯\_(ツ)_/¯

    Monday, December 23, 2013 8:23 AM
  • I had the same experience as the original poster.  However, there is a happy ending: create the EFI System partition using PowerShell, assign a drive letter if you want, but do not format the associated volume.  Run Windows setup.  It will format the EFI System partition and complete successfully.

    It's OK to use PowerShell to create the other partitions and format the associated volumes as detailed above, just omit formatting the volume associated with the EFI System partition.

    Sunday, August 17, 2014 1:53 AM
  • I have been trying to find a disk I can sacrifice.  Everyone has an error of some kind when I try to et it up as an EFI boot disk.  THat means that I cannot exactly duplicate what you are doing.

    I do not really think it is a PowerShell issue since you can create and format all but the SYSTEM type partition.

    I cannot be much more help until I can find a trashable disk.

    Try posting in the MDT forum to see if anyone else has seen this.


    ¯\_(ツ)_/¯

    Ha! Did someone say MDT! (I am an MDT Forum Moderator)

    Anywho, to summarize here the problem here is that the powershell cmdlet Format-Volume on the back end will use the WMI MSFT_Volume class and the Format() Method to perform the actual format.

    *However* the problem is that the OS *won't* even enumerate the GPT System partition type for MSFT_Volume or Win32_Volume, so there is nothing for Powershell to do here. 

    We could make the argument that the System type should be included in the WMI enumeration, but it wouldn't surprise me if the Windows Product Group would argue this unique type shouldn't be enumerated.

    There is a lot of weirdness in the Windows subsystem with respect to what get's enumerated by who, and when. Take the DiskMgmt.msc tool, note how uEFI primary disks have no "reserved" partition, yet if you were to go into diskpart.exe it would be listed? Yea weirdness...

    The correct answer here is... This is a bug/limitation in the OS, so use diskpart to format System partitions from within Powershell.exe


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Friday, December 12, 2014 8:55 AM
  • Wmi is very good at identifying GPT partitions:

    PS C:\scripts> gwmi win32_diskpartition|select Type

    Type
    -----------
    GPT: Unknown
    GPT: System
    GPT: Basic Data
    GPT: Unknown
    GPT: Unknown
    GPT: Unknown

    Notice the partitions are very nicely marked.

    Yes use diskpart or other lowlevel and vendor utilities.


    ¯\_(ツ)_/¯


    • Edited by jrv Friday, December 12, 2014 9:11 AM
    Friday, December 12, 2014 9:02 AM
  • That's intresting, however Partitions are not Volumes. Typically on most machines your Volume will directly corelate with a specific partition, however it is possible to have volumes across multiple partitions (think RAID) so...
    In this case we are ONLY intrested in Volumes, since we want to format, and the format() method is only present on the MSFT_Volume WMI class. If we can't get an instance of our GPT System "Volume" then we can't format it.

    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Friday, December 12, 2014 9:18 AM
  • A partition is not a volume.  Format is for a volume. GPT is a low level structure.  GPT refers to the "partition table type".or "GUID Partition Table".  MBR Means"Master Boot Record" type.  A volume is a logical structure built on one or more partitions.  Format can only be applied to a partrion set called a volume.  "Logical Disks" are created from partitions.  Format comes after the partition type is creted.

    Se this: http://msdn.microsoft.com/en-us/library/windows/hardware/dn640535(v=vs.85).aspx


    ¯\_(ツ)_/¯


    • Edited by jrv Friday, December 12, 2014 1:31 PM
    Friday, December 12, 2014 1:18 PM
  • What? Are you just paraphrasing (repeating), or disagreeing with what I said?


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Friday, December 12, 2014 6:22 PM
  • What? Are you just paraphrasing (repeating), or disagreeing with what I said?


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com


    Adding a bit of clarification. You cannot create an EFI partition by formatting a volume.

    ¯\_(ツ)_/¯

    Friday, December 12, 2014 7:35 PM