Skip to content

Instantly share code, notes, and snippets.

@SteveL-MSFT
Created March 24, 2021 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SteveL-MSFT/399cd7a96d2a431b0a758e937d711318 to your computer and use it in GitHub Desktop.
Save SteveL-MSFT/399cd7a96d2a431b0a758e937d711318 to your computer and use it in GitHub Desktop.
[DscResource()]
class FileContentResource {
[DscProperty(Key)]
[string] $filePath
[DscProperty(Mandatory)]
[string] $content
[FileContentResource] Get()
{
$this.content = Get-Content -Path $this.filePath
return $this
}
[void] Set()
{
Set-Content -Path $this.filePath -Value $this.Content
}
[bool] Test()
{
return (Get-Content -Path $this.filePath) -eq $this.content
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment