Skip to content

Dev Drive DSC error message when not run as admin #284

@AdamBraden

Description

@AdamBraden

Problem description

Lost a little time running the DSC on a new vm, only to realize I forgot to run it under an admin command prompt. The error message is misleading and that's why took a bit to figure it out.

Verbose logs

Error: 
The configuration unit failed while attempting to apply the desired state.
There is no unallocated space available to create the Dev Drive volume. We found no partitions that could be resized to create '50Gb' of unallocated space.
<See the log file for additional details>
Some of the configuration was not applied successfully

DSC configuration

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2

###############################################################################
# Dev Drive - configure a 50GB dev drive                                      #
###############################################################################

properties:
  configurationVersion: 0.2.0
  resources:
   - resource: Disk
     id: DevDrive1
     directives:
       description: 'Format a new Dev Drive volume onto Disk 0'
       module: StorageDsc
       allowPrerelease: true
     settings:
       DiskId: '0'
       DiskIdType: 'Number'
       DriveLetter: 'E'
       FSLabel: 'DevDrive1'
       DevDrive: true
       AllowDestructive: true
       FSFormat: 'ReFS'
       Size: '50Gb'

Suggested solution

An error message that notifies the user to run the command as an administrator. I'm not sure if there are other patterns to follow, but something along the lines of:

Error: Administrator privileges required

Operating system the target node is running

OsName               : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 22621.1.amd64fre.ni_release.220506-1250
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version and build the target node is running

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

StorageDsc version

Name       Version Path
----       ------- ----
StorageDsc 6.0.0   C:\Users\adambr\OneDrive - Microsoft\Documents\PowerShell\Modules\StorageDsc\6.0.0\StorageDsc.psd1

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationThe issue is related to documentation only.help wantedThe issue is up for grabs for anyone in the community.questionThe issue is a question.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions