Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Tuesday, March 17, 2015

Start-DscConfiguration : The directory name is invalid.

I’ve been teaching PowerShell since version 1.  On occasion, I have to follow my own advice.  Here is the nifty little error that I received while playing around with DSC.

Start-DscConfiguration : The directory name is invalid.

At line:1 char:1

+ Start-DscConfiguration -Wait -Path C:\MyFaxConfig\LON-SVR1.mof -Verbo ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Start-DscConfiguration], IOException

    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.DesiredStateConfiguration.Commands.StartDscConfigurationCommand

Well, this is a pleasant one. Actually it is very simple.  Here is what I typed:

Start-DscConfiguration -Wait -Path C:\MyFaxConfig\LON-SVR1.mof -Verbose

Anybody???  After a lot of internet searches that came up with nothing, I turned to the help files.  Here is the example from the help file for Start-DscConfiguration:

Start-DscConfiguration -Path "C:\DSC\Configurations\" -Wait –Verbose 

In my version, I added the MOF file in the path.  That is not what the Path parameter is used for. Here is what I found for the Path parameter in the help file:

Specifies a file path of a folder that contains configuration settings files. The cmdlet publishes and applies this configuration to computers specified by the ComputerName parameter.


In other words, it will apply all configurations in that folder, not a specific one.  My bad.

2 comments:

Yanni Goudeuk said...

Hi Jason

Could you please let me know if DSC is developed only for windows 8 and over? It doesn't seem to be working on windows 7.

Thank you

Jeff Stewart said...

Don't put the file name in the path, just the directory.