Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AdamBraden opened this issue Feb 13, 2024 · 2 comments · May be fixed by #292
Open

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

AdamBraden opened this issue Feb 13, 2024 · 2 comments · May be fixed by #292
Labels
documentation The issue is related to documentation only. help wanted The issue is up for grabs for anyone in the community. question The issue is a question.

Comments

@AdamBraden
Copy link

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
@bbonaby
Copy link
Contributor

bbonaby commented Feb 13, 2024

Yes we'll need to add a check to confirm if we're running the DSC resource as Admin and also mention in the wiki that it is needed as well.

FYI for those who don't know the config file above is a WinGet DSC config file see: https://learn.microsoft.com/en-us/windows/package-manager/configuration/create#example-winget-configuration-file

@PlagueHO PlagueHO added bug The issue is a bug. needs investigation The issue needs to be investigated by the maintainers or/and the community. help wanted The issue is up for grabs for anyone in the community. question The issue is a question. documentation The issue is related to documentation only. and removed bug The issue is a bug. needs investigation The issue needs to be investigated by the maintainers or/and the community. labels Mar 16, 2024
@PlagueHO
Copy link
Member

We should add this to the README.md in here as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation The issue is related to documentation only. help wanted The issue is up for grabs for anyone in the community. question The issue is a question.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants