Quantcast
Channel: VMware Communities : Discussion List - Automation Tools
Viewing full articles (9071 articles)
Browse article index
↧

PowerShell question

$
0
0

Tossing this out into this area since it's the closest place I could figure it would/could belong.

 

We have a PowerShell script that runs and then emails out reports to a distribution list. Right now, it also sends out empty csv files (when there's no VMs in the list). I'm looking for a way to either have it not write/save the file if empty, or simply not email off empty files at the end.

 

This script runs every day, so it would be good to only have it send out the message (or only have attachments) when there's something in the file.

 

End of the script (where it does this) is currently:

$UnprotectedVMArray | sort Folder,VM | Export-Csv $csvReportFile -NoTypeInformation

#email

Email-Report -EmailTo $EmailList -Subject $EmailSubject -Body $EmailBody -SMTPProfile $SMTPProfile -Attachment $csvReportFile

 

I'd appreciate any assistance in getting the desired result.

↧

Viewing full articles (9071 articles)
Browse article index

Latest Images

Trending Articles



Latest Images