paulwetter / DocumentConfigMgrCB

This script attempts to document your entire Configuration Manager (MEMCM/SCCM) environment
https://wetterssource.com/documentconfigmgrcb
172 stars 45 forks source link

Email and archiving #58

Open Crewsr opened 4 years ago

Crewsr commented 4 years ago

At line 79, I added: [parameter(Mandatory=$False)] [string]$SMTPServer = "SMTP", [parameter(Mandatory=$False)] [string]$MailTo = "Richard Crews ", [parameter(Mandatory=$False)] [string]$MailFrom = "SCCM Monitor ", [parameter(Mandatory=$False)] [string]$SubjectLine = "SCCM Documentor", [parameter(Mandatory=$False)] [string]$CopyPath = "DocumentationFolderPath",

At the end I added: Write-host "Beginning copy of $FilePath to $CopyPath" Copy-Item $FilePath -Destination "$CopyPath" -Force Write-host "Sending email." Send-MailMessage -From $MailFrom -To $MailTo -Subject $SubjectLine -Body "Completed execution at $($ScriptEndTime.ToShortTimeString()) with a total execution time of $ExecTimeString A copy of the report has been saved to $CopyPath" -Attachments $FilePath -Priority High -SmtpServer $SmtpServer

paulwetter commented 3 years ago

I don't know that this is something i would build into the script. But, perhaps I'll update the script to return a basic object that could be used in a wrapper for email and archiving.
Object could include:

And really, archiving can be achieved by using the -AddDateTime switch parameter as it will append the date and time to the end of the file name.

ChadSimmons commented 3 years ago

@Crewsr I agree with @paulwetter. I would just use a wrapper script to call DocumentConfigMgrCB then do whatever I wanted with the HTML output.