Get-ItemState
SYNOPSIS
Gets the ItemState of all known items in the site
SYNTAX
Get-ItemState [-CamerasOnly] [<CommonParameters>]
DESCRIPTION
Sends a MessageCommunication.ProvideCurrentStateRequest message and returns the response.
The ProvideCurrentStateResponse contains a flat collection of ItemState objects representing the state of all known items in the site. Each ItemState contains an FQID, and State property. The FQID.Kind and FQID.ObjectId can be used to determine what type of object the state represents, and the ID of that object.
Most of the time, you will probably only be interested in Camera objects, so you can filter the output with the -CamerasOnly switch.
EXAMPLES
EXAMPLE 1
Get-ItemState -CamerasOnly | Where-Object State -ne "Responding" | Foreach-Object { $camera = Get-Camera -Id $_.FQID.ObjectId; Write-Warning "Camera $($camera.Name) state is $($_.State)" }
Write a warning for every camera found with a state that is not "Responding"
EXAMPLE 2
Get-ItemState | % { $camera = Get-Camera -Id $_.FQID.ObjectId; $hardware = $camera | Get-ConfigurationItem -ParentItem; # Do something else here}
powershell
Gets the associated Hardware object for every Camera ItemState result.
PARAMETERS
-CamerasOnly
Filter the ItemState results to Camera items
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: False
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.