Solved

find $warning and the $critical for a FS

Posted on 2013-06-03
2
228 Views
Last Modified: 2013-06-04
Hello

Monitoring.txt contains :

z:\mssql:FS:20%:30%
z:\mssql\:FS:20%:30%
k:\mssql:FS:OFF
k:\mssql\:FS:OFF

I search to modify the following code to find the $warning and the $critical for a FS
$thresholds = @()
get-content $MONITORING | ? { $_ -like '*:FS:*%' } | % {
  $val = $_ -split ':' -replace '%'
  $thresholds += New-Object PsObject -Property @{
    $fs       = $val[0]+':'+$val[1]
    $warning  = $val[3]
    $critical = $val[4]
  }
}
$thresholds

How can I do it?
0
Comment
Question by:bibi92
2 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39216400
When you create PS object use the property name (you have used VAR, if you have property names assigned to this VAR's then it will work)..

$thresholds = @()
get-content $MONITORING | ? { $_ -like '*:FS:*%' } | % {
  $val = $_ -split ':' -replace '%'
  $thresholds += New-Object PsObject -Property @{
    fs       = $val[0]+':'+$val[1]
    warning  = $val[3]
    critical = $val[4]
  }
}
$thresholds 

Open in new window

0
 

Author Closing Comment

by:bibi92
ID: 39218494
Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question