Skip to content

Disk: Get-TargetResource "non-terminating" error with Azure Machine Configuration #305

@billings7

Description

@billings7

Problem description

When used with Azure Machine Configuration, this resource fails with the message:

This event indicates that a non-terminating error was thrown when DSCEngine was executing Get-TargetResource on DSC_Disk DSC resource. FullyQualifiedErrorId is Exception,Invoke-DeviceIoControlWrapperForDevDriveQuery. Error Message is Exception calling "DeviceIoControlWrapperForDevDriveQuery" with "1" argument(s): "DeviceIoControl unable to query if volume is a Dev Drive volume".

Did some testing and it looks like DeviceIoControlWrapperForDevDriveQuery always throws an exception if the drive is not a Dev Drive, rather than returning false.

Works fine when running via Invoke-DscResource, but I guess Azure Machine Configuration still checks for any silent errors (can see the error in $Error). Whether it should be checking for these kinds of errors, I don't know, but probably best if the error was avoided anyway.

Verbose logs

<GCLOG>[2025-07-18 18:27:34.194] [PID 3324] [TID 9676] [TELEMETRY DSCManagedEngine] [WARNING] [00000000-0000-0000-0000-000000000000] [:0] Job 85dec822-e0c0-48ea-b3e0-f2475199f2cb : This event indicates that a non-terminating error was thrown when DSCEngine was executing Get-TargetResource on DSC_Disk DSC resource. FullyQualifiedErrorId is Exception,Invoke-DeviceIoControlWrapperForDevDriveQuery. Error Message is Exception calling "DeviceIoControlWrapperForDevDriveQuery" with "1" argument(s): "DeviceIoControl unable to query if volume is a Dev Drive volume".</GCLOG>
<GCLOG>[2025-07-18 18:27:34.647] [PID 3324] [TID 9676] [TELEMETRY DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [C:\__w\1\s\src\dsc\engine\ConfigurationManager\LocalConfigManagerHelper.c:5991] Job 85dec822-e0c0-48ea-b3e0-f2475199f2cb : MIResult: 1
Error Message: Exception calling "DeviceIoControlWrapperForDevDriveQuery" with "1" argument(s): "DeviceIoControl unable to query if volume is a Dev Drive volume"
Message ID: Exception,Invoke-DeviceIoControlWrapperForDevDriveQuery
Error Category: 0
Error Code: 1
Error Type: MI</GCLOG>
<GCLOG>[2025-07-18 18:27:34.696] [PID 3324] [TID 9676] [TELEMETRY DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [C:\__w\1\s\src\dsc\engine\ca\CAInfrastructure\CAEngine.c:1773] Job 85dec822-e0c0-48ea-b3e0-f2475199f2cb : This event indicates that failure happens when LCM is processing the configuration. Error Id is 1. Error Detail is The SendConfigurationApply function did not succeed.. Resource Id is [Disk]CVolume and Source Info is ...\dsc\Storage.ps1::20::5::Disk. Error Message is The PowerShell DSC resource '[Disk]CVolume' with SourceInfo '...\dsc\Storage.ps1::20::5::Disk' threw one or more non-terminating errors while running the Get-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details..</GCLOG>
<GCLOG>[2025-07-18 18:27:34.700] [PID 3324] [TID 9676] [TELEMETRY DSCEngine] [ERROR] [00000000-0000-0000-0000-000000000000] [C:\__w\1\s\src\dsc\engine\ConfigurationManager\LocalConfigManagerHelper.c:6044] Job 85dec822-e0c0-48ea-b3e0-f2475199f2cb : MIResult: 1
Error Message: The PowerShell DSC resource '[Disk]CVolume' with SourceInfo '...\dsc\Storage.ps1::20::5::Disk' threw one or more non-terminating errors while running the Get-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
Message ID: NonTerminatingErrorFromProvider
Error Category: 7
Error Code: 1
Error Type: MI</GCLOG>
<GCLOG>[2025-07-18 18:27:37.612] [PID 3324] [TID 9208] [TELEMETRY Pull Client] [INFO] [85dec822-e0c0-48ea-b3e0-f2475199f2cb] Sending assignment report for assignment 'Storage'</GCLOG>
<GCLOG>[2025-07-18 18:27:41.898] [PID 3324] [TID 9208] [TELEMETRY Reports] [INFO] [85dec822-e0c0-48ea-b3e0-f2475199f2cb] Sent assignment report for job '85dec822-e0c0-48ea-b3e0-f2475199f2cb'. Compliance = false'</GCLOG>
<GCLOG>[2025-07-18 18:27:41.903] [PID 3324] [TID 9208] [TELEMETRY WORKER] [ERROR] [989cf275-18af-4c8d-a91a-1b64cdc02550] Failed to Run Consistency for 'Storage' DSC Error : Exception calling "DeviceIoControlWrapperForDevDriveQuery" with "1" argument(s): "DeviceIoControl unable to query if volume is a Dev Drive volume"
The PowerShell DSC resource '[Disk]CVolume' with SourceInfo '...\dsc\Storage.ps1::20::5::Disk' threw one or more non-terminating errors while running the Get-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
, Call Stack : 
1. dsc::dsc_settings::policy_from_assignment_name [0x7ffa27956280]
2. dsc::dsc_settings::policy_from_assignment_name [0x7ffa27956280]
3. DSCLib_GetDscConfiguration [0x7ffa21b99960]
4. DSCLib_GetDscConfiguration [0x7ffa21b99960]
5. dsc::consistency_operations::consistency_operations [0x7ffa25de3a90]
6. dsc::consistency_operations::consistency_operations [0x7ffa25de3a90]
7. dsc::consistency_operations::consistency_operations [0x7ffa25de3a90]
8. dsc::consistency_operations::consistency_operations [0x7ffa25de3a90]
9. dsc::gc_operations::update_timer [0x7ffa27912680]
c. wcsrchr [0x7ffa46083660]
d. BaseThreadInitThunk [0x7ffa4727e8c0]
e. RtlUserThreadStart [0x7ffa487714d0]
</GCLOG>

DSC configuration

Configuration Storage
{
    Import-DscResource -ModuleName StorageDsc -Name Disk

    Disk CVolume
    {
        DiskId = 0
        DriveLetter = 'C'
        FSLabel = 'OS'
        AllowDestructive = $true
    }
}

Storage

Suggested solution

Changing this line:

inputVolumeInfo.FlagMask = PERSISTENT_VOLUME_STATE_DEV_VOLUME;

to

inputVolumeInfo.FlagMask = uint.MaxValue;

seems to resolve this issue from some testing.

Could also change the -ErrorAction here to Ignore to account for any other errors that could happen.

$DevDrive = Test-DevDriveVolume `
-VolumeGuidPath $volume.UniqueId `
-ErrorAction SilentlyContinue

Operating system the target node is running

Azure Machine Configuration run on:
Windows Server 22025 Datacenter Azure Edition, 24H2, OS Build 26100.4270
OsName               : Microsoft Windows Server 2025 Datacenter Azure Edition
OsOperatingSystemSKU : 407
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 26100.1.amd64fre.ge_release.240331-1435
OsLanguage           : en-US
OsMuiLanguages       : {en-US, en-GB}

Tested locally on:
Windows 11, 24H2, OS Build 26100.4349
OsName               : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 26100.1.amd64fre.ge_release.240331-1435
OsLanguage           : en-GB
OsMuiLanguages       : {en-GB, en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

StorageDsc version

StorageDsc 6.0.1   C:\Users\...\Documents\PowerShell\Modules\StorageDsc\6.0.1\StorageDsc.psd1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.good first issueThe issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHubhelp wantedThe issue is up for grabs for anyone in the community.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions