Link to home
Start Free TrialLog in
Avatar of tankergoblin
tankergoblin

asked on

powershell

Hi,

How to write a script to calculate how many files in a folder every 1 min. If files is more than 10 then send an email to administrator.

Also how to get cpu utilization in Linux OS... do i need snmp to do so?
Avatar of Joseph Daly
Joseph Daly
Flag of United States of America image

The below powerhsell script should work for the count.

$dir = gci c:\directory\directory
$count = $dir.count
if ($count -gt 10) {Send-MailMessage -to "user@domain.com" -Subject "Warning message" -from user@domain.com -smtpserver server.domain.com -body "message body"}
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tankergoblin
tankergoblin

ASKER

i was been told that powershell almost can do everything you can think of... so are you sure powershell is not compatible to linux platform?
is that mean we can or cannot get information from other platform? if can pls show me some link that show some code on it...