PowerShell Cmdlets for Monitor Cluster Management
    • Dark
      Light
    • PDF

    PowerShell Cmdlets for Monitor Cluster Management

    • Dark
      Light
    • PDF

    Article Summary

    From ControlUp version 8.6.5, our PowerShell cmdlets allow you to get deep insights into the activity of your monitor cluster and its connected data sources. 

    Benefits of using cmdlets

    • Programmatic interface. You can use your PowerShell knowledge to programmatically access monitor data. Build your own scripts to automatically perform tasks or write an ad-hoc command to query a specific metric from any ControlUp entity, such as virtual machines, user sessions, or running processes. 
    • Troubleshooting. Are you missing historical or real-time data from specific machines in the web UI? Does the monitor have trouble connecting to a ControlUp Agent? The cmdlets are useful in troubleshooting issues.
    • Performance and scalability. The performance of the cmdlets scales well with data growth. You can run the cmdlets without any degradation in performance in large environments with tens of thousands of ControlUp Agents.

     Prerequisites

    • ControlUp version 8.6.5 or higher
    • You must have at least one ControlUp Monitor installed
    • Permissions to run scripts on the monitor machines

    PowerShell Cmdlets Overview

    • Invoke-CUQuery. Queries the monitors' in-memory database for the current state and displays the data in the PowerShell session. 
    • Export-CUQuery. Queries the monitor's in-memory database and exports the results to a JSON or CSV file.
    • Get-CUVendorVMs. Returns all machines under a specific folder path. This folder path is the property of a ControlUp extension, such as Horizon, CVAD, Azure, or AWS.

    Getting Started

    Step 1: Import the Module to your PowerShell Session

    Before you can start using the cmdlets, import the ControlUp.PowerShell.User module on a monitor machine into your PowerShell session.

    $pathtomodule = (Get-ChildItem "C:\Program Files\Smart-X\ControlUpMonitor\*ControlUp.PowerShell.User.dll" -Recurse | Sort-Object LastWriteTime -Descending)[0]
    Import-Module $pathtomodule

    The module was imported successfully if no error message is shown.

    Step 2: Learning about the Cmdlets

    As soon as you import the module, you are ready to use it. To learn more about each cmdlet, refer to the Invoke-CUQuery and Export-CUQuery articles.
    Additionally, you can use PowerShell's built-in help system Get-Help which covers the syntax and parameters in great detail.

    Get-Help Invoke-CUQuery -Full

    Step 3: Read the Reference

    Refer to the reference table to see how you can query the monitor's in-RAM database. When using the cmdlets to query the database, make sure you type your parameter values correctly since they are case-sensitive.

    Step 4: Run your First Query

    Let's run your first query against the monitor's in-memory database. In this example, we will use a command to query all machines that show a critical Stress Level.

    (Invoke-CUQuery -Scheme Main -Table Computers -Fields sName, SeverityLevel -Where "SeverityLevel = '5.0'").Data






    Was this article helpful?