# 'DependsOn' property ignored in custom resource

**URL:** <https://forums.powershell.org/t/dependson-property-ignored-in-custom-resource/4390>\
**Category:** DSC\
**Created:** [June 17, 2015, 12:45pm UTC](https://forums.powershell.org/t/dependson-property-ignored-in-custom-resource/4390 "2015-06-17T12:45:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian-casey-douglas](https://avatars.discourse-cdn.com/v4/letter/i/9fc29f/32.png) [@ian-casey-douglas](https://forums.powershell.org/u/ian-casey-douglas)\
**Post date:** [June 17, 2015, 12:45pm UTC](https://forums.powershell.org/t/dependson-property-ignored-in-custom-resource/4390/1 "2015-06-17T12:45:08Z")

</div>

I have created a custom resource ‘SyncShare’ and I can get it to run with expected results if I copy the resource folder to the modulepath on the target node. However, if I try to combine copying that resource to the target and applying it in a single configuration ( see below), the LCM on the target says that the resource isn’t in the psmodulepath --despite the fact that I have used the ‘DependsOn’ property to ensure that the directory exists. In fact, the custom resource is not respecting the dependsOn property at all, since I find that it is always being evaluated before the file resource that would make that resource available. See this configuration fragment:

File Resource\_SyncShare  
{  
Type = “Directory”  
DestinationPath = $Node.ResourceRootPath+“\SyncShare”  
SourcePath = $Node.ResourceSourcePath+“\SyncShare”  
Ensure = “Present”  
MatchSource = $True  
Recurse = $True  
Force = $True  
Credential = $Credential  
Checksum = “modifiedDate”  
}

```
    SyncShare Tools
        {
            Name = "Tools"
            SourceDirectory = $Node.ToolsDirSourcePath
            DestinationDirectory = $Node.ToolsDirDestinationPath
            ChecksumFileName = "sync.checksum"
            Ensure = "Present"
            DependsOn = "[File]Resource_SyncShare"
        }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [June 17, 2015, 1:25pm UTC](https://forums.powershell.org/t/dependson-property-ignored-in-custom-resource/4390/2 "2015-06-17T13:25:39Z")

</div>

The LCM is probably reading the whole file and making sure that the resources exist before it starts to actually execute anything. You won’t be able to distribute the resources that way.

If you’re using a pull server, don’t worry about it, as the resources will be downloaded from there on an as-needed basis. If you’re using Push deployments, then you’ll need to copy out the necessary resources just before you execute Start-DscConfiguration.

In PowerShell v5, you can do a hybrid of the two, where a pull server is used to download resources, but you can still apply configurations with a push via Start-DscConfiguration.

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [June 17, 2015, 1:41pm UTC](https://forums.powershell.org/t/dependson-property-ignored-in-custom-resource/4390/3 "2015-06-17T13:41:31Z")

</div>

Correct: the LCM pre-scans the file to make sure it has every resource needed before it processes anything. And, as Dave notes, it’ll then grab modules from a pull server, if so configured. So you can’t use a config to file-copy a resource AND use that resource. This is essentially what a pull server is meant to help solve.

---

<div class="post-metadata">

**Author:** ![ian-casey-douglas](https://avatars.discourse-cdn.com/v4/letter/i/9fc29f/32.png) [@ian-casey-douglas](https://forums.powershell.org/u/ian-casey-douglas)\
**Post date:** [June 18, 2015, 4:45am UTC](https://forums.powershell.org/t/dependson-property-ignored-in-custom-resource/4390/4 "2015-06-18T04:45:30Z")

</div>

Thanks for the reply. I’m going to wait on setting up a pull server in prod until WMF5 is in GA.

---

<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/dependson-property-ignored-in-custom-resource/4390/5 "2024-05-16T21:17:17Z")

</div>


