Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

how to select more folder?

$
0
0

Hi guys,

I want to get more info out of my folders, at the moment i will receive an email if nothing has been added. My problem is i dont know how to let the script run for multiple folders. Any help is appreciated.

Script below:

[string]$path = @("X:\Brievenbus\Customer1")


 $File = Get-ChildItem $Path | Where { $_.LastWriteTime -ge [datetime]::Now.AddMinutes(-1) }

$SMTPMessage = @{
To = $To
From = $From
Subject = "$Subject at $Path"
Smtpserver = $SMTPServer
}


ForEach ($path in $path){
#$File = Get-ChildItem $Path | Where { $_.LastWriteTime -ge [datetime]::Now.AddMinutes(-1) }
If ($File -eq $null)
{ $SMTPBody = "`nLaatste 24H is er niets meer gestuurd bij klant:`n`n $($_.FullName) $path"

Send-MailMessage @SMTPMessage -Body $SMTPBody
}
}


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>