# first DSC config..no MOF created

**URL:** <https://forums.powershell.org/t/first-dsc-config-no-mof-created/6184>\
**Category:** DSC\
**Created:** [April 11, 2016, 10:53am UTC](https://forums.powershell.org/t/first-dsc-config-no-mof-created/6184 "2016-04-11T10:53:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhavenn](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@rhavenn](https://forums.powershell.org/u/rhavenn)\
**Post date:** [April 11, 2016, 10:53am UTC](https://forums.powershell.org/t/first-dsc-config-no-mof-created/6184/1 "2016-04-11T10:53:18Z")

</div>

I’m trying to get a first DSC config working and while I can get it to run cleanly and create an output directory. I don’t get any MOF files.

I have a pull server setup, etc… and all that seems to be okay. My config script is just using a “File” source to pull in some files. I’m using “ConfigurationNames” in my LCMs. So, if the LCM pulls this file then I want it to apply. However, that’s step 2 🙂

PS v5 is used.

My script looks like this:

```
##define nodes
$ConfigData = 
@{
AllNodes = 
@(
    @{
        #applies to all nodes
        NodeName = "*";

        #install files to
        InstallDest = "C:\\Program Files\Zabbix\\";

    }
);

#define some variable(s) that are global to the config
NonNodeData = 
@{
    #resource location - Zabbix EXE files (copy all .exe files)
    InstallFiles = "\\\\networkfilepath\\Zabbix\Agent\\3.0.0\win64\\";

 }   
} 

Configuration Install_Zabbix_Agent
{
#load DSC resources (Get-DscResource shows all available Modules and names)
#Import-DscResource -ModuleName PSDesiredStateConfiguration -Name Script;

#all nodes using this DSC
Node $AllNodes.NodeName
{

    #file resource
    File CreateZabbixDir
    {

        Ensure = "Present";
        Type = "Directory";
        CheckSum = "SHA-1";
        SourcePath = $ConfigurationData.NonNodeData.InstallFiles;
        DestinationPath = $Node.InstallDest;

    }

}
}
#call the config
Install_Zabbix_Agent
```

I run the .ps1 and I don’t get any MOF files. Just a empty directory. No errors.

---

<div class="post-metadata">

**Author:** ![silent-steel](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@silent-steel](https://forums.powershell.org/u/silent-steel)\
**Post date:** [April 11, 2016, 2:46pm UTC](https://forums.powershell.org/t/first-dsc-config-no-mof-created/6184/2 "2016-04-11T14:46:45Z")

</div>

In the $ConfigData section, you’re missing a node with the real name. To create a mof file you must supply a node name, be it local host or actual server name.

Stating NodeName=“\*” only means that everything that follows will be settings available for all the rest of the nodes. Else, logically running your script will create an infinite number of mof files 🙂

---

<div class="post-metadata">

**Author:** ![rhavenn](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@rhavenn](https://forums.powershell.org/u/rhavenn)\
**Post date:** [April 12, 2016, 3:14am UTC](https://forums.powershell.org/t/first-dsc-config-no-mof-created/6184/3 "2016-04-12T03:14:27Z")

</div>

Thanks. I thought it would just create a Install\_Zabbix\_Agent.mof .

So, I will drop the “ConfigData” section as I want a MOF file that I will apply via ConfigurationNames and the LCM config will decide which MOF(s) to pull.

This then creates the single MOF file in question.

---

<div class="post-metadata">

**Author:** ![silent-steel](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@silent-steel](https://forums.powershell.org/u/silent-steel)\
**Post date:** [April 12, 2016, 5:40am UTC](https://forums.powershell.org/t/first-dsc-config-no-mof-created/6184/4 "2016-04-12T05:40:53Z")

</div>

The mof file will always follow the nodename. you either supply the nodename via the $ConfigData or as a parameter to the command.

When you want to use it in conjunction with ConfigurationNames, use localhost as the node name, it will create a localhost.mof, you then rename it to what ever you want to match the value you placed in the ConfigurationNames in the LCM script

---

<div class="post-metadata">

**Author:** ![rhavenn](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@rhavenn](https://forums.powershell.org/u/rhavenn)\
**Post date:** [April 12, 2016, 9:43am UTC](https://forums.powershell.org/t/first-dsc-config-no-mof-created/6184/5 "2016-04-12T09:43:16Z")

</div>

Thanks.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 9:17pm UTC](https://forums.powershell.org/t/first-dsc-config-no-mof-created/6184/6 "2024-05-16T21:17:03Z")

</div>

Closed on May 16, 2024, 9:17pm UTC


