PowerShell
Nodinite enables you to monitor, automate, and empower users with custom PowerShell scripts on your Windows Servers. With this feature, you can run scripts for advanced monitoring, automate routine tasks, and provide secure self-service actions for end-users—all from a single, unified platform.
✅ Execute virtually any PowerShell script for custom monitoring and automation
✅ Empower end-users to run scripts as Remote Actions on demand
✅ Centralize script management and execution for security and compliance
Info
Learn how to utilize your own PowerShell scripts for custom monitoring, enabling end-users to execute them through self-service enabled Nodinite Monitor Views.
This mermaid diagram shows how PowerShell script resources are configured, monitored, and evaluated in Nodinite, including remote actions for troubleshooting and automation.
This diagram illustrates how Nodinite executes PowerShell scripts both locally and remotely, enabling flexible monitoring and automation across your infrastructure.
Note
⚠️ You must have WMF 5.1 or later.
⚠️ WinRM must be enabled on remote Windows Server if you are using the PowerShell feature with a remote target.
This page outlines how Nodinite monitors the PowerShell Category using one or more role-based Monitor Views. You can configure state evaluation based on user-defined logic—globally or for specific scripts. Remote commands (Actions) are available to help you swiftly address reported problems. All implemented Remote Actions are detailed below.

Example list of monitored 'PowerShell' resources in a Monitor View.
Monitoring Features
- Administrators manually manage your PowerShell configurations. Sharing insights is easy with Monitor Views.
- State Evaluation – Based on script output:
Write-Warningfor Warnings,Write-Errorfor Errors. - Category-based monitoring – Group monitored Resources by Categories for streamlined management.
State evaluation for PowerShell-based monitoring
Nodinite displays each monitored PowerShell configuration as a Resources. For example, if you have 2 Windows Server configurations with 2 and 3 PowerShell scripts, you will have 5 'PowerShell' resources in Nodinite.
The Resources name matches the name of the PowerShell configuration.
The 'PowerShell' resource belongs to the following Category:
Category Description PowerShell Ensure PowerShell configurations stay within user-defined monitoring thresholds 
List of PowerShell-related resources in a Monitor View.The Application name is the Display Name of the Windows Server:

Example using the Application filter option in a Nodinite Monitor View.
Each item (presented in Nodinite as a Resource) is evaluated with a state: OK, Warning, Error, or Unavailable.
You can reconfigure state evaluation at the Resources level using the Expected State feature.
Note
Depending on the user-defined synchronization interval for the Windows Server Monitoring Agent, there may be a delay before Nodinite Web Client/Monitor Views reflect changes. Click Sync All (or use the dropdown for individual agent selection) to force a resynchronization.

Option to force Nodinite to request a resynchronization with the Monitoring Agent.
PowerShell Monitoring
For the PowerShell category, Nodinite evaluates the monitored state as described below:
| State | Status | Description | Actions | |
|---|---|---|---|---|
| Unavailable | Service not available | The server can't be reached or evaluated due to network or security issues | Review prerequisites | |
| Error | Error state raised | The script fails or contains Write-Error in the output | Details Show Action Scripts |
|
| Warning | Warning state raised | The script failed or contains Write-Warning in the output | Details Show Action Scripts |
|
| OK | Operational | The 'PowerShell' configuration is valid, and the script executes without any errors or warnings | Details Show Action Scripts |
Remote Actions for PowerShell
The following Remote Actions are available for the PowerShell Category:

Available remote actions for the PowerShell category.
Details
View details for any PowerShell resource by clicking the Action button and selecting Details in the 'Control Center' section.

Open details modal using the 'Details' action.
Next, click the option to open the modal.

Example of the 'Details' modal.
Show Action Scripts
Manage and execute scripts for any PowerShell resource by clicking the Action button and selecting Show Action Scripts in the 'Control Center' section.

Open the scripts modal using the 'Show Action Scripts' action.
Next, click the option to open the modal.

Example of the 'Action Scripts' modal.
Click the Execute button to run the script on demand.

The user must confirm the intent to execute the script.
The output is presented at the bottom of the modal.

Example of the result from the operation.
Configuration
Use Remote Configuration to manage PowerShell configuration.
PowerShell tab
Click the PowerShell tab to manage PowerShell monitoring options.

Example of the 'PowerShell' configuration tab.
| State | Example code | Description |
|---|---|---|
| OK | echo "Hello World" | Script runs without errors and has no warnings or errors written to the output |
| Warning | Write-Warning "Warning for moderate rain" | Script runs without errors and has a warning written to the output |
| Error | Write-Error "General failure reading from disk" | Script fails or has errors written to the output |
Important
Output Formatting for Objects and Tables: All PowerShell operations that return objects, tables, or non-string results SHOULD use
| Out-Stringto ensure proper output formatting in Nodinite.Examples requiring
| Out-String:# Table results Get-Process | Select-Object -First 5 | Out-String # Object properties Get-Service -Name "Spooler" | Format-List | Out-String # System information Get-ComputerInfo | Select-Object CsName, OsVersion | Out-StringWithout
| Out-String, object output may not display correctly in the Nodinite Web Client or Remote Actions results.
Click the Add button to add a new entry. This will become the Resource as seen in Monitor Views.
PowerShell General tab
This is the monitoring entry.
- Enabled – When checked, this PowerShell Script is monitored
- Display Name – The user-friendly name of this resource as provided to end-users within Monitor Views
- Description – User-friendly description for the PowerShell Script resource
- PowerShell Script – The script to use for monitoring

Example of the PowerShell configuration General tab.
User Action Scripts
This entry allows the System Administrator to provide a script collection for end-users with permission to execute content as Remote Actions.

Example of the PowerShell User Script Collection tab.
Click the Add button for each script to include in the script collection.

Example of a PowerShell User Script entry.
PowerShell Authentication
Set authentication options for executing the PowerShell script.

Example of the PowerShell configuration Authentication tab.
Check the checkbox to execute the script on another target host.
- Is remote server – When checked, these PowerShell Scripts run on a remote server.
- Address – The address for the remote server.
- Use authentication – When checked, authenticate to the remote server or impersonate a user locally via the username and password fields below.
- Domain User – The name of the Windows user account. Format: DOMAIN\User.
- Password – The password for the provided domain user.

Example of the PowerShell configuration Authentication fields.
PowerShell Script Examples
Below are practical examples demonstrating state evaluation and proper output formatting for common monitoring scenarios.
Example 1: Simple OK State
Returns a success message without warnings or errors:
# Monitor disk space - OK state
$drive = Get-PSDrive C
$freeSpaceGB = [math]::Round($drive.Free / 1GB, 2)
Write-Output "Drive C: has $freeSpaceGB GB free space available"
Expected State: OK
Example 2: Warning State
Triggers a warning when a threshold is approached:
# Monitor disk space - Warning when below 20%
$drive = Get-PSDrive C
$freeSpacePercent = [math]::Round(($drive.Free / $drive.Used) * 100, 2)
if ($freeSpacePercent -lt 20) {
Write-Warning "Drive C: is running low on space: $freeSpacePercent% free"
} else {
Write-Output "Drive C: has sufficient space: $freeSpacePercent% free"
}
Expected State: Warning (when below 20%)
Example 3: Error State
Triggers an error when a critical threshold is exceeded:
# Monitor disk space - Error when below 10%
$drive = Get-PSDrive C
$freeSpacePercent = [math]::Round(($drive.Free / $drive.Used) * 100, 2)
if ($freeSpacePercent -lt 10) {
Write-Error "CRITICAL: Drive C: is critically low on space: $freeSpacePercent% free"
} elseif ($freeSpacePercent -lt 20) {
Write-Warning "Drive C: is running low on space: $freeSpacePercent% free"
} else {
Write-Output "Drive C: has sufficient space: $freeSpacePercent% free"
}
Expected State: Error (when below 10%)
Example 4: Table Output with Out-String
Displays service status in a formatted table (demonstrates | Out-String):
# Monitor multiple Windows Services with table output
$services = @('W3SVC', 'WinRM', 'MSSQLSERVER')
$results = foreach ($serviceName in $services) {
$service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue
if ($null -eq $service) {
[PSCustomObject]@{
Service = $serviceName
Status = 'NotFound'
State = 'Error'
}
Write-Error "Service '$serviceName' not found on this server"
} elseif ($service.Status -ne 'Running') {
[PSCustomObject]@{
Service = $serviceName
Status = $service.Status
State = 'Warning'
}
Write-Warning "Service '$serviceName' is not running (Status: $($service.Status))"
} else {
[PSCustomObject]@{
Service = $serviceName
Status = $service.Status
State = 'OK'
}
}
}
# Output table with proper formatting
$results | Format-Table -AutoSize | Out-String
Expected State: Varies based on service status (OK if all running, Warning/Error otherwise)
Key Point: | Out-String ensures the table displays correctly in Nodinite Web Client
Example 5: System Information with Out-String
Retrieves system information with proper formatting:
# Monitor server uptime and basic info
$os = Get-CimInstance -ClassName Win32_OperatingSystem
$uptime = (Get-Date) - $os.LastBootUpTime
$info = [PSCustomObject]@{
ServerName = $env:COMPUTERNAME
'Uptime (Days)' = [math]::Round($uptime.TotalDays, 2)
'OS Version' = $os.Caption
'Free Memory (GB)' = [math]::Round($os.FreePhysicalMemory / 1MB, 2)
}
# Check if uptime is too long (e.g., > 90 days)
if ($uptime.TotalDays -gt 90) {
Write-Warning "Server has not been rebooted in $([math]::Round($uptime.TotalDays, 0)) days"
}
# Output formatted information
$info | Format-List | Out-String
Expected State: Warning (if uptime > 90 days)
Key Point: | Out-String formats object properties for readable output
Example 6: Multiple Checks with Combined States
Performs multiple checks and combines state evaluation:
# Comprehensive server health check
$errorCount = 0
$warningCount = 0
# Check 1: CPU Usage
$cpu = Get-CimInstance Win32_Processor | Measure-Object -Property LoadPercentage -Average
if ($cpu.Average -gt 90) {
Write-Error "CPU usage is critically high: $($cpu.Average)%"
$errorCount++
} elseif ($cpu.Average -gt 70) {
Write-Warning "CPU usage is elevated: $($cpu.Average)%"
$warningCount++
}
# Check 2: Memory Usage
$os = Get-CimInstance Win32_OperatingSystem
$memoryUsedPercent = [math]::Round((($os.TotalVisibleMemorySize - $os.FreePhysicalMemory) / $os.TotalVisibleMemorySize) * 100, 2)
if ($memoryUsedPercent -gt 95) {
Write-Error "Memory usage is critically high: $memoryUsedPercent%"
$errorCount++
} elseif ($memoryUsedPercent -gt 85) {
Write-Warning "Memory usage is elevated: $memoryUsedPercent%"
$warningCount++
}
# Check 3: Critical Services
$criticalServices = @('W3SVC', 'WinRM')
foreach ($serviceName in $criticalServices) {
$service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue
if ($null -eq $service -or $service.Status -ne 'Running') {
Write-Error "Critical service '$serviceName' is not running"
$errorCount++
}
}
# Summary output
$summary = [PSCustomObject]@{
'Server' = $env:COMPUTERNAME
'CPU Usage %' = $cpu.Average
'Memory Usage %' = $memoryUsedPercent
'Errors' = $errorCount
'Warnings' = $warningCount
}
$summary | Format-List | Out-String
if ($errorCount -eq 0 -and $warningCount -eq 0) {
Write-Output "All health checks passed successfully"
}
Expected State: Varies based on multiple conditions
Key Point: Demonstrates combining multiple checks with proper state evaluation and formatted output
Next Step
Related Topics
Windows Server Monitoring Agent Resources Monitoring Monitor Views SQL Server - SQL Statements - Similar monitoring approach using custom TSQL scripts How to Monitor a Clustered Windows Service - PowerShell example for clustered service monitoring