Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Powershell to monitor IIS AppPool & formatting the results

Posted on 2014-02-10
2
Medium Priority
?
1,923 Views
Last Modified: 2014-02-10
Hi all,
I am attempting to create a PowerShell script that I will ultimately plug into our application monitoring system;
Specifically, I am looking to create a script that will identify a specific IIS application pool, and then return the amount of memory used by that pool's worker process. I pretty much have it getting what I need, but in order to integrate this with our monitoring solution I need to format the output of the script a bit...
Here is what I have:
$serverName=$args[0]
$applicationPoolName=$args[1]
$memUsed = Get-WmiObject Win32_process -ComputerName $serverName | where CommandLine -Match $applicationPoolName | fl VM

Open in new window


So, I call this script from a PowerShell prompt:
CheckAppPool.ps1 servername appPoolName

The results are returned as:
VM  :  123456789

I need to figure out a way to have the results returned to me so they look like this:
memUsed 123456789

Any assistance is greatly appreciated!!

Thanks,

David
0
Comment
Question by:nacAdmin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 41

Accepted Solution

by:
footech earned 2000 total points
ID: 39848360
Try the following:
$memUsed = Get-WmiObject Win32_process -ComputerName $serverName | where CommandLine -Match $applicationPoolName | ForEach { "memUsed {0}" -f $_.VM }

Open in new window

0
 

Author Closing Comment

by:nacAdmin
ID: 39848370
Awesome! Thanks so much!
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

636 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