Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Query PowerShell via Agent

Query PowerShell via Agent

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 13.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    A
    Anders
    wrote on last edited by
    #1

    Hi,

    I wonder if it would be possible to execute a PowerShell command via the agent and return the output result to NetXMS for monitoring? For example, I'd like to send the following PowerShell query to my Exchange 2010 server, in order to find out how many e-mails currently are waiting delivery in mail queue:

    Get-Queue -Sort-Order:-MessageCount -Result:1 | fl -Property MessageCount
    

    Maybe there is a better solution for what I'm attempting?

    Thanks!

    Anders

    1 Reply Last reply
    0
    • V
      V
      Victor Kirhenshtein
      wrote on last edited by
      #2

      Hi!

      You can define external parameter in agent. Add the following line to your nxagentd.conf:

      ExternalParameter = Exchange.MessageCount:powershell -Command "& {Get-Queue -Sort-Order:-MessageCount -Result:1 | fl -Property MessageCount}"

      Part before : is a name for new parameter, you can set it whatever you want.

      Restart agent, do configuration poll on a node, and you should see new parameter in parameters oist and be able to collect it as any other agent's parameter.

      Best regards,
      Victor

      1 Reply Last reply
      0
      • A
        A
        Anders
        wrote on last edited by
        #3

        Thank you Victor!

        1 Reply Last reply
        0

        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
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        Powered by NodeBB Contributors
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups