cWaitForFile.psm1
enum Ensure { Absent Present } [DscResource()] class cWaitForFile { [DscProperty(Key)] [string]$Path [DscProperty(Mandatory)] [Ensure]$Ensure = [Ensure]::Present <# This method is equivalent of the Get-TargetResource script function. The implementation should use the keys to find appropriate resources. This method returns an instance of this class with the updated key properties. #> [cWaitForFile] Get() { return $this } <# This method is equivalent of the Set-TargetResource script function. It sets the resource to the desired state. #> [void] Set() { switch ($this.Ensure) { [Ensure]::Present { } [Ensure]::Absent { } } } <# This method is equivalent of the Test-TargetResource script function. It should return True or False, showing whether the resource is in a desired state. #> [bool] Test() { switch ($this.Ensure) { [Ensure]::Present { return Test-Path $this.Path } [Ensure]::Absent { return !Test-Path $this.Path } } return $false } } |