Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

How to reference an output value to store in another variable

$
0
0

Hi, I dont know powershell but do use some scripts I get from the web to assist with particular tasks.  One such script I use (provided by Jonathan Almquist), is for checking is Ops Manager Alert Grooming is working.  His script is as follows

$Threshold=(Get-Date).AddDays(-(get-defaultsetting)[42].Value-1).ToUniversalTime().Date.AddMinutes(30);Get-Alert | Where {$_.TimeResolved -and $_.TimeResolved -lt $Threshold} | Measure-Object

The output of this is a table in the form:

Count    : 0
Average  :
Sum      :
Maximum  :
Minimum  :
Property :

Basically if the valuse for count is 0 then all good but higher numbers indicate an issue.

What I want to to is be able to store the value of count, so I can reference the outputted result.  What I am specifically doing is building an Orchestrator runbook whcih used a .Net acitiy (ie runs a powershell) and have embedded the script above but I need to store the result in i presume a variable so I can pass to another activity in the runbook - I am wanting to set the runbook to run once a day to run the script and pass back the 'Count' value.

Any help much appreciated....


Viewing all articles
Browse latest Browse all 8411

Trending Articles