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.
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(4128)
Ego Is the Enemy by Ryan Holiday(3989)
Offensive Shellcode from Scratch by Rishalin Pillay(3645)
Exploring Deepfakes by Bryan Lyon and Matt Tora(3227)
Robo-Advisor with Python by Aki Ranin(2995)
Learning C# by Developing Games with Unity 2021 by Harrison Ferrone(2859)
Speed Up Your Python with Rust by Maxwell Flitton(2840)
Liar's Poker by Michael Lewis(2809)
Agile Security Operations by Hinne Hettema(2793)
OPNsense Beginner to Professional by Julio Cesar Bueno de Camargo(2793)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic and Jasmin Redzepagic(2792)
Extreme DAX by Michiel Rozema & Henk Vlootman(2788)
Essential Cryptography for JavaScript Developers by Alessandro Segala(2731)
Elevating React Web Development with Gatsby by Samuel Larsen-Disney(2721)
AI-Powered Commerce by Andy Pandharikar & Frederik Bussler(2638)
Python for ArcGIS Pro by Silas Toms Bill Parker(2634)
Cryptography Algorithms by Massimo Bertaccini(2624)
Distributed .NET with Microsoft Orleans by Bhupesh Guptha Muthiyalu Suneel Kumar Kunani(2621)
Incident Response Techniques for Ransomware Attacks by Oleg Skulkin(2620)