Powershell help
-
Hello @all,
i have following code in a template:
<config> <core> <ExternalMetric>WindowsADUserGroup.Count(*):powershell -NoProfile -NonInteractive -Command "Write-Host ((Get-ADGroupMember -Identity '$1' -Recursive | Where-Object { $_.objectClass -eq 'user' }).count)"</ExternalMetric> </core> </config>If i run the code directly on a server, there are no errors..
If i run the script via NetXMS DC, i getting the error that "_.objectClass" is not found...
Where is my fault? I didn't get a solution for that... Many thanks for any help...
Greetings
Marco -
Try escaping $ in the query
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login