PowerShell Fast Track by Vikas Sukhija
Author:Vikas Sukhija
Language: eng
Format: epub
ISBN: 9781484277591
Publisher: Apress
if ($error)
{
Send-MailMessage -SmtpServer $smtpserver -From $from -To $to -Subject $subject -Body $error[0].ToString()
$error.clear()
}
Listing 7-1Sending Errors via Email
Listing 7-1 is missing one important thing. It just sends the last error, but what if you want to send the full error, which is actually an array and send-mailmessage is not able to send it effectively? You can utilize the Send-Email function in Listing 7-2, which is also part of the vsadmin module that was shared in the modules chapter.function Send-Email
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
$From,
[Parameter(Mandatory = $true)]
[array]$To,
[array]$bcc,
[array]$cc,
$body,
$subject,
$attachment,
[Parameter(Mandatory = $true)]
$smtpserver
)
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Exploring Deepfakes by Bryan Lyon and Matt Tora(7730)
Robo-Advisor with Python by Aki Ranin(7626)
Offensive Shellcode from Scratch by Rishalin Pillay(6106)
Microsoft 365 and SharePoint Online Cookbook by Gaurav Mahajan Sudeep Ghatak Nate Chamberlain Scott Brewster(5025)
Ego Is the Enemy by Ryan Holiday(4958)
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4438)
Python for ArcGIS Pro by Silas Toms Bill Parker(4184)
Elevating React Web Development with Gatsby by Samuel Larsen-Disney(3890)
Machine Learning at Scale with H2O by Gregory Keys | David Whiting(3627)
Learning C# by Developing Games with Unity 2021 by Harrison Ferrone(3285)
Speed Up Your Python with Rust by Maxwell Flitton(3231)
Liar's Poker by Michael Lewis(3225)
OPNsense Beginner to Professional by Julio Cesar Bueno de Camargo(3195)
Extreme DAX by Michiel Rozema & Henk Vlootman(3172)
Agile Security Operations by Hinne Hettema(3124)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic and Jasmin Redzepagic(3109)
Essential Cryptography for JavaScript Developers by Alessandro Segala(3083)
Cryptography Algorithms by Massimo Bertaccini(3001)
AI-Powered Commerce by Andy Pandharikar & Frederik Bussler(2983)
