I was working on a custom monitor at one of my customers using a powershell script. It involved creating a dataset to store some variables coming from a SQL database.
When trying to save the monitor I got an error stating: Incorrect expression specified: $Data = New-Object System.Data.dataset
A quick search pointed at that it was regarding to the variable $Data, apparently that is a reserved “name”. Getting rid of that solved the problem and it works like a charm.
Hope this helps to save some time!