PowerShell Cmdlet Example

This Powershell script will query a given Region / Database combination and retrieve some status.

$Region = “ESDEMO”
$DBInstance = “(local)”
$SeeRegions = Get-SEERegions

foreach ($SEERegion in $SEERegions)
	# if it is the region name / database we are interested in.
	if($SEERegion.Name.Contains($Region) -and $SEERegion.DBInstance.Contains($DBInstance))
  # get the region status
  $RegionStatus = get-SEERegionstatus -region $Region -usedb $DBInstance
  # and emit some interesting stuff about the region.
  write-host "Region $Region is  $($SEERegion.RegionState)"
  write-host "               has $($RegionStatus.ActiveTasks) Active Tasks"
  # and then get what each SEP instance is busy with.
  foreach($SepStatus in $RegionStatus.SepTasksStatus)
  	# write out some interesting SEP stuff.
   write-host " Request ID $($SepStatus.RequestID) processing transaction id $($SepStatus.CicsTranId) from terminal $($SepStatus.CicsTermId) "