PowerShell doesn't recognise DSC commands

Welcome Forums DSC (Desired State Configuration) PowerShell doesn't recognise DSC commands

This topic contains 2 replies, has 3 voices, and was last updated by

 
Participant
12 months ago.

  • Author
    Posts
  • #88928

    Participant
    Points: 0
    Rank: Member

    It was working and now its not.
    Has anyone else see this issue? All of a sudden PowerShell does not recognize the Configuration command.

    Here is my sample configuration I am using
    Configuration testing123
    {
    Import-DscResource -ModuleName 'xTimeZone'

    xTimeZone Central{
    IsSingleInstance = 'yes'
    TimeZone = 'Eastern Standard Time'
    }
    }

    Here is the error message I am receiving.
    At line:1 char:15
    + Configuration testing123
    + ~~~~~~~~~~
    System.Management.Automation.PSArgumentException: Cannot process argument because the value of argument "fullFilePath" is not valid. Change the value of the "fullFilePath" argument and run the operation again.
    at Microsoft.PowerShell.DesiredStateConfiguration.CimDSCParser.GetFileContent(String fullFilePath)
    at Microsoft.PowerShell.DesiredStateConfiguration.CimDSCParser.ParseSchemaMof(String filePath)
    at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.ImportClasses(String path, Tuple`2 moduleInfo, Collection`1 errors, Boolean importInBoxResourcesImplicitly)
    at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.Initialize(Collection`1 errors, List`1 modulePathList)
    at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.LoadDefaultCimKeywords(Dictionary`2 functionsToDefine, Collection`1 errors, List`1 modulePathList, Boolean cacheResourcesFromMultipleModuleVersions)
    at System.Management.Automation.Language.Parser.ConfigurationStatementRule(IEnumerable`1 customAttributes, Token configurationToken)
    At line:2 char:1
    + {
    + ~
    Unexpected token '{' in expression or statement.
    At line:9 char:1
    + }
    + ~
    Unexpected token '}' in expression or statement.
    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ParserError

  • #89125

    Participant
    Points: 0
    Rank: Member

    What's the context for where this is running?

  • #89894

    Participant
    Points: 88
    Helping Hand
    Rank: Member

    FYI i have just tested this

    Configuration testing123
    {
    Import-DscResource -ModuleName 'xTimeZone'
    
    xTimeZone Central{
    IsSingleInstance = 'yes'
    TimeZone = 'Eastern Standard Time'
    }
    }
    
    testing123
    

    And it worked fine. How are you able to reproduce this?

The topic ‘PowerShell doesn't recognise DSC commands’ is closed to new replies.