hello
I have set up a condition and policy to check if datafiles have a @GrowthType of KB. This works fine when i execute in management studio but i'm having problems using powershell. I'm not sure what to set the -TargetExpression to. This is the code i'm trying to execute...
$DatabaseName = 'master'
$ServerInstance = 'localhost'
$TargetExpression = "Server[@Name='$ServerInstance']/Database[@Name='$DatabaseName']"
Set-Location "SQLSERVER:\SQLPolicy\localhost\Policies\"
$pol = (Get-ChildItem | Where-Object {$_.DisplayName -eq "DataFileGrowth"}) | Invoke-PolicyEvaluation -TargetServerName "$ServerInstance" -TargetExpression $TargetExpression
$ReturnedValue = $pol.Result
$ReturnedValue