Created
October 24, 2016 19:55
-
-
Save bgelens/1246ac64ffbb7518597f6e71137c301c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test-ClassResource | |
{ | |
param( | |
[Parameter(ValueFromPipeline=$True,Mandatory=$True)] | |
[string]$fileName | |
) | |
$ast = [System.Management.Automation.Language.Parser]::ParseFile($fileName, [ref]$null, [ref]$null) | |
$result = foreach ($item in $ast.FindAll({$args[0] -is [System.Management.Automation.Language.AttributeAst]}, $false)) | |
{ | |
if ($item.Extent.Text -eq '[DscResource()]') | |
{ | |
$true | |
} | |
} | |
if ($result) | |
{ | |
$true | |
} | |
else | |
{ | |
$false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment