LogoDark mode logo
LogoDark mode logo
Contact SupportLoading Light/Dark Toggle

Data sources

data sourcespowershell on premise plugin

PowerShell On-Prem plugin

This plugin is one of two available for PowerShell. Make sure to choose the correct version depending on your requirements:

Currently only PowerShell v7 is supported for this plugin.

  • PowerShell plugin: Visualize data from PowerShell scripts (cloud only).
  • PowerShell On-Prem plugin: Run user-created PowerShell scripts on Relay Agents.

Run user-created PowerShell scripts on Relay Agents.

An on-prem data source uses a relay agent to connect SquaredUp to a data source running on your internal network.

A relay agent is installed on a server on your internal network, and has access to your data source.

Using a relay agent means that you don't need to open your firewall to allow access.

Adding a data source

To add a data source click on the + next to Data Sources on the left-hand menu in SquaredUp. Search for the data source and click on it to open the Configure data source page.

Before you start

Create the PowerShell scripts

Your PowerShell scripts can serve two different functions:

Import script

In case you need to import new objects into SquaredUp, you need an import script. This script contains the definitions for objects and their links in the Knowledge Graph. There can only be one import script per PowerShell On-Prem data source.

You can add more PowerShell On-Prem data sources to SquaredUp if you want to use different import scripts, and they can all use the same folder.

Data Stream script

All other scripts are Data Stream scripts. Those scripts contain the different Data Streams you want to use when you are creating tiles for a dashboard.

Import scripts return objects to SquaredUp using the following format:

Import scripts write objects to SquaredUp in the following format:

@{
vertices = @()
edges = @()
}

Example import script

Information about parameters in the script:

Vertex (vertices create objects in SquaredUp)

name
string – the name of the vertex
sourceId
string – a unique ID identifying the vertex
type
string – the high-level type of the vertex
Note: A lot of types are already pre-defined in SquaredUp, which means they will be displayed properly with an icon etc. To make sure the type you're using matches with a pre-defined one, use lowercase only, one word without hypens, and the singular form (for example loadbalancer, apidomain, dnsrecord). If your type isn't recognized, you can add it as a custom type, see Types and Custom Types.
sourceType
string – a type for the vertex pertinent to your specific use-case
other properties
You can use any other properties of use in your specific use-case

Edges (edges create links between objects in SquaredUp):

label
string – the type of edge
inV
string – the sourceId value of the vertex the edge enters
outV
string – the sourceId value of the vertex the edge leaves
get-objects.ps1:
@{
    vertices = @(Get-CimInstance -Class Win32_LogicalDisk |
        ? { $_.DriveType -eq 3 } |
    %{
        [PSCustomObject]@{
            name = ('{0} {1}' -f $_.SystemName,$_.Name)
            sourceId = ('\\{0}\root\cimv2:Win32_LogicalDisk.DeviceID="{1}" ({2})' -f $_.SystemName,$_.Name,$_.VolumeSerialNumber)
            type="storage"
            sourceType="volume"
            FileSystem = $_.FileSystem
            Compressed = $_.Compressed
            Size = $_.Size
        }
    })
    edges = @()
}

Data Stream scripts return objects to SquaredUp using the following format:

Data Stream scripts return data as a simple array of objects:

@()

Example Data Stream script

Data stream scripts are selected when Using the PowerShell On-Prem data streams .

They can also be used when Writing a custom data stream (advanced users) that calls your Data Stream script. This is done from Settings > Advanced > Data Streams.

The format of the result objects of your script needs to match the columns you've defined in the custom Data Stream.

get-diskFreeSpace.ps1:
Param(
    [Parameter(Mandatory=$true)]
    $scope
)

$targetObjectsBySourceId = @{}
foreach ($targetObject in $scope) {
    $targetObjectsBySourceId[$targetObject.sourceId[0]] = $targetObject
}

$results = (Get-CimInstance -Class Win32_LogicalDisk |
    ? { $_.DriveType -eq 3 } |
%{
    $sourceId = '\\{0}\root\cimv2:Win32_LogicalDisk.DeviceID="{1}" ({2})' -f
        $_.SystemName,$_.Name,$_.VolumeSerialNumber
    if ($targetObjectsBySourceId.ContainsKey($sourceId)) {
        [PSCustomObject]@{
            name = ('{0} {1}' -f $_.SystemName,$_.Name)
            Size = $_.Size
            FreeSpace = $_.FreeSpace
        }
    }
})

return $results

Scripts can optionally define the timeframe parameter, and will receive the tile timeframe as an object with various time representations as properties as follows:

start: "2024-02-19T21:05:00.000Z"
unixStart: 1708376700
end: "2024-02-19T22:05:00.000Z"
unixEnd: 1708380300
enum: "last1hour"
interval: "PT1H"

If you are adding a plugin marked as On-Prem, you will need a relay agent that can access the server hosting your on-prem data source. You do not need a relay agent for cloud plugins.

If you have already created a relay agent in SquaredUp that can access this data source, then you can skip this step and choose the agent group you want to use while Configuring the data source.

You can install an agent on either Windows or Linux:

  • Configuring an agent (Windows platforms)
  • Configuring an agent (Linux platforms)

Configuring the data source

  1. Display name:
    Enter a name for your data source. This helps you to identify this data source in the list of your data sources.

  2. Agent group:
    Select the Agent Group that contains the agent(s) you want to use.

  3. Scripts Directory:
    Enter the path to the directory where you store the PowerShell scripts on the machine you deployed the agent on.

    The path must be written as an absolute path, for example
    C:\Scripts\SquaredUpCloud
    or, if you are using a network share,
    \\fs01\Scripts\SquaredUpCloud

  4. Import Script:
    Optional. If you want to use a script for importing objects into SquaredUp, you can specify that script here by entering its full file name, for example
    get-objects.ps

    The import script must be stored in the same directory you defined above.

  5. Only allow signed scripts (Windows only):
    If you select this checkbox, no unsigned PowerShell scripts will be executed. This applies to all scripts run by the data source, not just the import script.
  6. (Optional) Restrict access to this data source:
    You can enable this option if you only want certain users or groups to have access to the data source, or the permission to link it to new workspaces. See data source access control for more information.

    The term data source here really means data source instance. For example, a user may configure two instances of the AWS data source, one for their development environment and one for production. In that case, each data source instance has its own access control settings.

    By default, Restrict access to this data source is set to off. The data source can be viewed, edited and administered by anyone. If you would like to control who has access to this data source, switch Restrict access to this data source to on.

    Use the Restrict access to this data source dropdown to control who has access to the workspace:

    • By default, the user setting the permissions for the data source will be given Full Control and the Everyone group will be given Link to workspace permissions.
    • Tailor access to the data source, as required, by selecting individual users or user groups from the dropdown and giving them Link to workspace or Full Control permissions.
    • If the user is not available from the dropdown, you are able to invite them to the data source by typing in their email address and then clicking Add. The new user will then receive an email inviting them to create an account on SquaredUp. Once the account has been created, they will gain access to the organization.
    • At least one user or group must be given Full Control.
    • Admin users can edit the configuration, modify the Access Control List (ACL) and delete the data source, regardless of the ACL chosen.

    Access level
    Permissions
    Link to workspace
    • User can link the data source to any workspace they have at least Editor permissions for.
    • Data from the data source can then be viewed by anyone with any access to the workspace.
    • User can share the data source data with anyone they want.
    • User cannot configure the data source in any way, or delete it.
    Full Control
    • User can change the data source configuration, ACL, and delete the data source.

    See Access control for more information.

  7. Click Add. If you defined an import script, it will run shortly and the objects will subsequently appear in the Map in the new workspace.

Testing and troubleshooting

If you encounter an error, refer to the guidance provided below or contact [email protected] with as much detail as possible for assistance.

Why can’t I see my scripts listed in parameters when configuring a tile?

There is no validation on the script path you enter when setting up the Powershell On-Prem Data Source, ensure the provided path is valid and that any scripts are saved in *.ps1 format.

Why isn’t my script returning expected data?

We’d always recommend ensuring that any scripts will successfully run outside of SquaredUp in the first case, and that data is formatted and returned correctly. If everything looks okay, you may wish to review how the columns are being used in the shaping and columns tabs in the tile configuration.

Next steps

Data streams

You can use these data streams to create new tiles to show data, or if there are preconfigured dashboards installed you can copy or edit those.

Data streams standardize data from all the different shapes and formats your tools use into a straightforward tabular format.

While creating a tile you can tweak data streams by grouping or aggregating specific columns.

Depending on the kind of data, SquaredUp will automatically suggest how to visualize the result, for example as a table or line graph.

Data streams can be either global or scoped:

  • Global data streams are unscoped and return information of a general nature (e.g. "Get the current number of unused hosts").
  • A scoped data stream gets information relevant to the specific set objects supplied in the tile scope (e.g. "Get the current session count for these hosts").

See Data Streams for more information.

The following data streams are installed with this plugin.

This global data stream allows you to enter and run custom PoweShell scripts.

  1. Select the run script on-prem data stream. Click Next to go to the Parameters tab.
  2. Script Path:
    Select a script to use. This dropdown displays the scripts you have configured in your scripts folder.
  3. Script Arguments:
    Optionally, enter any arguments required by the selected script. These are custom arguments set by the script author in the script itself.

    If the script is not expecting these parameters, including them will cause the stream to fail.

    Arguments are expressed as a JSON object, where the property name is the name of the parameter, and the value is what should be passed to the script. For example:
    { "TopN": 10, "filter": ["**/Bin", "*.zip"] }

This scoped data stream allows you to enter and run custom PoweShell scripts.

  1. Select the run script on-prem data stream. Click Next to go to the Objects tab.
  2. Select the objects that you want to query. Click Next to go to the Parameters tab.
  3. Script Path:
    Select a script to use. This dropdown displays the scripts you have configured in your scripts folder.
  4. Script Arguments:
    Optionally, enter any arguments required by the selected script. These are custom arguments set by the script author in the script itself.

    If the script is not expecting these parameters, including them will cause the stream to fail.

    Arguments are expressed as a JSON object, where the property name is the name of the parameter, and the value is what should be passed to the script. For example:
    { "TopN": 10, "filter": ["**/Bin", "*.zip"] }

Writing a custom data stream (advanced users)

Optionally, you can choose to create your own custom data streams.

Data streams standardize data from all the different shapes and formats your tools use into a straightforward tabular format.

While creating a tile you can tweak data streams by grouping or aggregating specific columns.

Depending on the kind of data, SquaredUp will automatically suggest how to visualize the result, for example as a table or line graph.

Data streams can be either global or scoped:

  • Global data streams are unscoped and return information of a general nature (e.g. "Get the current number of unused hosts").
  • A scoped data stream gets information relevant to the specific set objects supplied in the tile scope (e.g. "Get the current session count for these hosts").

See Data Streams for more information.

  1. Go to Settings > Advanced > Data Streams.
  2. Add a new Data Stream with the following settings:
    Display Name
    This name will be displayed when you are creating tiles on a dashboard and can pick Data Streams.
    Data source
    Choose the PowerShell On-Prem data source.
    Entry point
    You can either use a scope of objects (list scope) or not limit the scope to specific objects (no scope).
    If you use the list scope, the Data Stream will only be visible when creating a tile that has those objects in its scope. Which objects are included is defined by the matches parameter in the Data Stream JSON.

    You can use all parameters you used for defining vertices in the import script as criteria for which objects to include (e.g. a specific type of object).

  3. Enter the JSON for the Data Stream in the code box.

    Information about parameters in the script:

    dataSourceConfig.scriptPath
    Defines which script is run by this Data Stream
    dataSourceConfig.scriptArguments
    Optionally, enter any arguments required by the selected script. These are custom arguments set by the script author in the script itself.

    If the script is not expecting these parameters, including them will cause the stream to fail.

    matches
    If you selected the entry point "list scope", here you define for which objects the Data Stream will be visible when creating a tile.

    You can use all parameters you used for defining vertices in the import script as criteria for which objects to include (e.g. a specific type of object).

    metadata
    Allows you to customize how the results are displayed in SquaredUp. You can modify which columns are shown as well as their format, for example currencies, dates, and storage units. You can also specify which columns are the label and which are the value for the visualization.
    See Custom Data Streams for more information on metadata schema reference.
    {
      "name": "diskSpace",
      "dataSourceConfig": {
        "scriptPath": "get-diskFreeSpace.ps1"
      },
      "matches": {
        "sourceType.0": {
          "type": "equals",
          "value": "volume"
        }
      },
      "rowPath": [
        "results"
      ],
      "metadata": []
    }

Was this article helpful?


Have more questions or facing an issue?
Submit a ticket

On this page

  • Adding a data source
  • Before you start
  • Create the PowerShell scripts
  • Configuring the data source
  • Testing and troubleshooting
  • Next steps
  • Data streams
  • Writing a custom data stream (advanced users)

Footer

Sites

  • SquaredUp
  • SQUAREDUP DS
  • DOWNLOAD
  • COMMUNITY ANSWERS

Quick Links

  • Contact Support
  • Events
  • Careers

Small Print

  • Privacy Policy
  • Terms and Conditions
YoutubeX (Twitter)LinkedInBlueSky

© SquaredUp 2025