dsccommunity / StorageDsc

DSC resource module is used to manage storage on Windows Servers.
https://dsccommunity.org
MIT License
70 stars 51 forks source link

Error Thrown in xMountImage when mounting VHD on Windows Server 2012 R2 #105

Closed PlagueHO closed 7 years ago

PlagueHO commented 7 years ago

After enabling integration tests to be run in AppVeyor without Hyper-V, this exposed an issue when mounting a VHD in Windows Server 2012 R2.

An error would be thrown in Mount-DiskImageToLetter:

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' =
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer WIN-5BAJTO3LS9E with user sid S-1-5-21-3806771146-4194721918-2584193979-500.
VERBOSE: [WIN-5BAJTO3LS9E]: LCM:  [ Start  Set      ]
VERBOSE: [WIN-5BAJTO3LS9E]: LCM:  [ Start  Resource ]  [[xMountImage]Integration_Test]
VERBOSE: [WIN-5BAJTO3LS9E]: LCM:  [ Start  Test     ]  [[xMountImage]Integration_Test]
VERBOSE: [WIN-5BAJTO3LS9E]:                            [[xMountImage]Integration_Test] Test-TargetResource: Testing Mounted Drive for image file 'D'.
VERBOSE: [WIN-5BAJTO3LS9E]:                            [[xMountImage]Integration_Test] Get-TargetResource: Getting Mounted Drive for image file
'C:\Users\ADMINI~1\AppData\Local\Temp\2\TestDisk.vhd'.
VERBOSE: [WIN-5BAJTO3LS9E]:                            [[xMountImage]Integration_Test] Test-TargetResource: The image file 'C:\Users\ADMINI~1\AppData\Local\Temp\2\TestDisk.vhd' is
 not mounted to drive 'D' but should be. Change required.
VERBOSE: [WIN-5BAJTO3LS9E]: LCM:  [ End    Test     ]  [[xMountImage]Integration_Test]  in 0.0320 seconds.
VERBOSE: [WIN-5BAJTO3LS9E]: LCM:  [ Start  Set      ]  [[xMountImage]Integration_Test]
VERBOSE: [WIN-5BAJTO3LS9E]:                            [[xMountImage]Integration_Test] Set-TargetResource: Setting Mounted Drive for image file
'C:\Users\ADMINI~1\AppData\Local\Temp\2\TestDisk.vhd'.
VERBOSE: [WIN-5BAJTO3LS9E]:                            [[xMountImage]Integration_Test] Get-TargetResource: Getting Mounted Drive for image file
'C:\Users\ADMINI~1\AppData\Local\Temp\2\TestDisk.vhd'.
VERBOSE: [WIN-5BAJTO3LS9E]:                            [[xMountImage]Integration_Test] Set-TargetResource: The image file 'C:\Users\ADMINI~1\AppData\Local\Temp\2\TestDisk.vhd' is
being mounted as drive 'D'.
VERBOSE: [WIN-5BAJTO3LS9E]:                            [[xMountImage]Integration_Test] Mount-DiskImageToLetter: ISO image file
'C:\Users\ADMINI~1\AppData\Local\Temp\2\TestDisk.vhd' mounted as drive '' but is being changed to 'D'.
VERBOSE: [WIN-5BAJTO3LS9E]:                            [[xMountImage]Integration_Test] Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' =
root\cimv2,'className' = Win32_Volume'.
You cannot call a method on a null-valued expression.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    + PSComputerName        : localhost

You cannot call a method on a null-valued expression.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    + PSComputerName        : localhost

You cannot call a method on a null-valued expression.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    + PSComputerName        : localhost

You cannot call a method on a null-valued expression.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    + PSComputerName        : localhost

You cannot call a method on a null-valued expression.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    + PSComputerName        : localhost
PlagueHO commented 7 years ago

Fixed by #106