Normal usage of the get-monitor cmdlet uses the following syntax:
get-monitor -criteria 'Id = ''7da5b2dd-1d7a-0d63-f2be-3091b22fc726'''
I'm trying to use this cmdlet in a loop passing info from $alerts to feed the cmdlet but i've run into a syntax problem that I dont know how to get around. If I use
get-monitor -criteria 'Id = ''$alert.MonitoringRuleId'''
I get the following error which I kind of expeceted to get Get-Monitor : Id='$alert.MonitoringRuleId' -- Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx).Id='$alert.MonitoringRuleId' -- Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
How do I pass info in a loop to this cmdlet?
Any thoughts on this would be great!
Thank you!