PowerShell -- Instance Property Support
It had been ages since I had to write a datasource in PowerShell so I haven't stayed up-to-date on the latest bells and whistles available. But I was very surprised to see that instance properties are still not supported. With the substitution engine and enhancements made on the Groovy-side, I would have thought this trivial to implement. Is supporting instance properties on the horizon for PowerShell scripting for Datasources?
Joe_Tran
6 comments
mmatec01
Bump. This is still not working, i.e. getting Instance Level Properties (ILPs) in DataSource written in PowerShell. I just burned 8 hours trying to figure out why my script during Collection is coming up with empty strings during assignments of some custom ILPs. Sigh.
Jonathan_Arnold
You are correct in groovy you can do an instanceProps.get() – return the specified instance property e.g. instance = instanceProps.get("wildvalue")
This is available if you import the santaba module for Groovy. Unfortunately, we don't have anything like that for Powershell at this time.
Mike Moniz
Interesting, and works in Groovy? I haven't though of doing it that way before, learn something new :)/emoticons/smile@2x.png 2x" title=":)" width="20">
I typically would either have the same basic code from AD in the collector script (since I attempt to use BatchScript whenever possible) or pass values over via wildvalue/wildvalue2/wildalias.
Joe_Tran
OPSorry for being unclear. I was attempting to consume instance level properties in a PowerShell collection script.
The PowerShell Collection script tried assigning two ILPs to a variable-- one was a JSON formatted string (auto.events) and another was a plain ol' string (auto.logname). Like so:
It took a little testing and debugging to figure out that my attempts to iterate through the JSON object were failing because the substitution engine were making these empty strings
.
Jonathan_Arnold
Hi Joe,
Instance Level Properties (ILP's) are available in PowerShell Active Discovery scripts as long as they fit the following format as output.
https://www.logicmonitor.com/support/datasources/active-discovery/script-active-discovery/
Is this what you are trying to accomplish? Or are you trying to use a Powershell PropertySource?
Mike Moniz
Creating instance (auto) properties or attempting to use instance auto properties created from the AD script in the collection script?