Hi,
Please refer to the screenshot below to replace your script:
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi All,
I am trying to create an alert using Powershell MP in SCOM. The script is used to monitor DNSlint status. The DNSint cmd will output the status which we can export as html file.
The html file output contains following details for all the DNS servers in the domain.
Total number of CNAME records found on this server: 10
Total number of CNAME records missing on this server: 0
Total number of glue (A) records this server could not find: 0
If the above numbers does not match should trigger an alert. I have created a script which outputs the same as string, but I don't know how to add this in Powershell MP, using property bag feature.
$a = (Get-Content -Path 'D:\dnslint_CNAMEandGLUE.htm' |
Select-String -Pattern 'Total GUIDs found')
if ($a -match '10') {
Write-Host 'Total GUIDs found is 10'}
else {Write-Host 'GUIDs Failed'}
$b = (Get-Content -Path 'D:\dnslint_CNAMEandGLUE.htm' |
Select-String -Pattern 'Total number of glue')
if ($b -match '0') {
Write-Host 'Total number of glue (A) records this server could not find: 0'}
else {Write-Host 'Glue records failed'}
$c = (Get-Content -Path 'D:\dnslint_CNAMEandGLUE.htm' |
Select-String -Pattern 'CNAME records found')
if ($c -match '10') {
Write-Host 'Total number of CNAME records found on this server: 10'}
else {Write-Host 'CNAME records found failed'}
$d = (Get-Content -Path 'D:\dnslint_CNAMEandGLUE.htm' |
Select-String -Pattern 'CNAME records missing')
if ($d -match '0') {
Write-Host 'Total number of CNAME records missing on this server: 0'}
else {Write-Host 'CNAME records missing failed'}
Please see the attached output for the script if DNSLint status is Good.
If the numbers are not matching script will output as below.
Kindly check the script and modify the same so that we can be alerted in SCOM if the data does not matches the desired output.
Thanks in Advance
Regards
Fadil CK.
Hi,
Please refer to the screenshot below to replace your script: