I am trying to initialize the disk in AWS. Here is the verbose log:
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Micr
osoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer OCTOPROVISION with user sid S-1-5-21-328967500-4131384653-1410793316-500.
VERBOSE: [OCTOPROVISION]: LCM: [ Start Set ]
VERBOSE: [OCTOPROVISION]: LCM: [ Start Resource ] [[WaitForDisk]Disk2]
VERBOSE: [OCTOPROVISION]: LCM: [ Start Test ] [[WaitForDisk]Disk2]
VERBOSE: [OCTOPROVISION]: [[WaitForDisk]Disk2] Test-TargetResource: Checking for disk with Number '1'.
VERBOSE: [OCTOPROVISION]: [[WaitForDisk]Disk2] Test-TargetResource: Found disk with Number '1' named 'AWS PVDISK'.
VERBOSE: [OCTOPROVISION]: LCM: [ End Test ] [[WaitForDisk]Disk2] in 0.0470 seconds.
VERBOSE: [OCTOPROVISION]: LCM: [ Skip Set ] [[WaitForDisk]Disk2]
VERBOSE: [OCTOPROVISION]: LCM: [ End Resource ] [[WaitForDisk]Disk2]
VERBOSE: [OCTOPROVISION]: LCM: [ Start Resource ] [[Disk]VolumeD]
VERBOSE: [OCTOPROVISION]: LCM: [ Start Test ] [[Disk]VolumeD]
VERBOSE: [OCTOPROVISION]: [[Disk]VolumeD] Test-TargetResource: Testing disk with Number '2' status for drive letter 'D'.
VERBOSE: [OCTOPROVISION]: [[Disk]VolumeD] Test-TargetResource: Checking if disk with Number '2' is initialized.
VERBOSE: [OCTOPROVISION]: [[Disk]VolumeD] Test-TargetResource: Disk with Number '2' was not found.
VERBOSE: [OCTOPROVISION]: LCM: [ End Test ] [[Disk]VolumeD] in 0.1090 seconds.
VERBOSE: [OCTOPROVISION]: LCM: [ Start Set ] [[Disk]VolumeD]
VERBOSE: [OCTOPROVISION]: [[Disk]VolumeD] Set-TargetResource: Setting disk with Number '2' status for drive letter 'D'.
VERBOSE: [OCTOPROVISION]: [[Disk]VolumeD] Set-TargetResource: Checking disk with Number '2' partition style.
VERBOSE: [OCTOPROVISION]: [[Disk]VolumeD] Set-TargetResource: Clearing disk with Number '2' of all existing partitions and volumes.
VERBOSE: [OCTOPROVISION]: LCM: [ End Set ] [[Disk]VolumeD] in 0.2050 seconds.
PowerShell DSC resource DSC_Disk failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Disk with Number '2' is already initialized
with partition style '' but 'MBR' is required. Set AllowDestructive and ClearDisk to $true to allow disk to be reinitialized.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : localhost
VERBOSE: [OCTOPROVISION]: LCM: [ End Set ]
The SendConfigurationApply function did not succeed.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : localhost
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 0.669 seconds
Found it. This happens with DiskID = 2, when I don't have such disk ID. Still, it would be useful to check if the disk exists and throw a more meaningful message.
I am trying to initialize the disk in AWS. Here is the verbose log:
Here is the DSC:
It doesn't matter if I set MBR or GPT. It doesn't do anything with ClearDisk /AllowDestructive
Thank you.