# Write out CSV file and give it a Data Stamp $ReportHtml = ($report | ConvertTo-Html | out-String) # parse info to be html ,and give it date stamp $report = Check VC VC01 for Disconnects and Maintenance mode and Not Respondingforeach($vc in $vCenters) # Clear old sessionsDisconnect-VIServer $vCenters -Confirm:$false Something like that $vCenters = "VC01","VC02","VC03" You could use a ForEach loop through all vCenters and combine the results in a $1 report. BodyAsHtml-body $reportHtml - accessories 'C:\PS\Output\VC_$CurrentDate.csv '. Send-MailMessage-to - subject VMwareMorningcheckVC01$ CurrentDate ' $Report | Export-Csv "C:\PS\Output\VC_$Currentdate.csv". $CurrentDate = $CurrentDate.ToString ('MM-dd-yyyy_hh-mm-ss') # Write CSV file and give it a character of data $ReportHtml = $report | ConvertTo-Html | Out-string # scan info to be html and give him a date stamp $Report = get-VMhost-State disconnected, maintenance, NotResponding | SELECT name, connectionstate ![]() SE connect-VIServer-Server VC01 - FakeUSer username-password FakePassword # VC01 VC check for disconnection and Maintenance mode and does not No disconnected/maintemance/notresponding hosts for VC3 I have a set of credentials, that work on all 3 of my VC It would be nice to have an HTML and CSV output that looks like this (assuming that there are currently disconnected etc.) ![]() How do I ForEach and always the hose of the same body CSV and HTML His job well, but need to send a mail to all three of our VCentersĬurrent script only works for a VC at a time. I have a working script that alerts to our logout ESXi hosts, maintenance and NotResponidng mode I need your expert advice for the very large environment and will award points. ![]() Hi guys, I'm total NOOB in CLI so please forgive the stupid question. Need help with an Export-CSV and ForEach loop
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |