Register-CommanderDataSource
SYNOPSIS
Registers a custom data source script block to run on an interval.
SYNTAX
Register-CommanderDataSource [-Name] <String> [-LoadData] <ScriptBlock> [[-RefreshInterval] <Int32>]
[[-HistoryLimit] <Int32>] [[-ArgumentList] <Object[]>] [<CommonParameters>]
DESCRIPTION
Registers a custom data source script block to run on an interval. Data sources can be used with desktop widgets.
EXAMPLES
EXAMPLE 1
Register-CommanderDataSource -Name 'ComputerInfo' -LoadData {
$Stats = Get-NetAdapterStatistics
$NetworkDown = 0
$Stats.ReceivedBytes | Foreach-Object { $NetworkDown += $_ }
$NetworkUp = 0
$Stats.SentBytes | Foreach-Object { $NetworkUp += $_ }
@{
CPU = Get-CimInstance Win32_Processor | Measure-Object -Property LoadPercentage -Average | Select-Object -Expand Average
Memory = (Get-Counter '\Memory\Available MBytes').CounterSamples.CookedValue
NetworkUp = $NetworkUp / 1KB
NetworkDown = $NetworkDown / 1KB
}
} -RefreshInterval 5
Gathers computer information and stores it as a data source.
PARAMETERS
-Name
The name of the data source.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LoadData
The data to load.
Type: System.Management.Automation.ScriptBlock
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-RefreshInterval
The refresh interval in seconds.
Type: System.Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: 60
Accept pipeline input: False
Accept wildcard characters: False
-HistoryLimit
The amount of history to retain.
Type: System.Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 10
Accept pipeline input: False
Accept wildcard characters: False
-ArgumentList
{{ Fill ArgumentList Description }}
Type: System.Object[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.