I have a procedure that runs a script that gets the biggest files on a machine and writes to a text file in the machine's C:\temp folder.
I want whoever runs this machine to have easy access to this file, whether by an email attachment or by getting the actual file put on their local machine, like their desktop.
I want to avoid forcing my helpdesk to search for the file in FTP. I also cannot use 'getVariable' as FileContent because it is formatted in tables via monospaced font.
Wishlist for Kaseya:
Whoever helps me with this gets a metaphorical cookie.
EDIT: A potential fix for this would be to have the procedure runner type in their machine name into a prompt upon running the script.
Alternatively, get the runner's machine from the KaseyaD.ini file somehow but that doesn't even make sense because how would I even asdfjeioaijfeoia
You could have the procedure ask for the tech's email, then use mailsend to attach it to an email. github.com/.../mailsend
Here is an example of emailing an attachment with mailsend. You can fill in parts of the command from procedure variables:
mailsend -t email@example.com -f firstname.lastname@example.org -sub "my subject line" -M "see attached!" -attach file.zip -smtp mailhost.example.com -port 25 -user email@example.com -pass thepassword -auth
I wanted to achieve a very similar result-- create filesize report locally on agent machine, email the report as attachment to our Connectwise alerts board, report is auto-attached to support ticket. 'sendEmail' can't email an attachment and mailsend requires too much customer-specific configuration, requires FW port 25 outbound for agent machine, etc.
We ended up using getFile to copy the file back to agent private folder, sending email to connectwise alert board which included (using variables from the alert) an internal link to the report in the agent's private getFile folder (\\Server\Profiles\#vAgentConfiguration.agentGuid#\GetFiles\#dl#_drive_size_report.rpt).
Now, if we could just get Low Disk alerts to reliably re-arm and not rely on system audits...
You say, "I have a procedure that runs a script that gets the biggest files on a machine and writes to a text file in the machine's C:\temp folder."
Is that script a VBScript? If so, it would be extremely easy to have the script send the file as an attachment.
You also say, "I want whoever runs this machine to have easy access to this file, whether by an email attachment or by getting the actual file put on their local machine, like their desktop."
Do you mean "whoever runs the machine" or do you really mean, "whoever runs the Procedure/Script"?
Use PowerShell to send the e-mail - with attachment - in HTML format.
Should be pretty easy.
Here you go - we use an SMTP server that is locked to our client's Public IP addresses. All clients can mail through it.
PowerShell command (you should have already defined a variable for your results file):
Send-MailMessage -To #adminDefaults.adminEmail# -Subject "#scriptIdTab.scriptName# completed on #vMachine.machName#" -Body "Here are the results of #scriptIdTab.scriptName# on #vMachine.machName# - see attachment." -SmtpServer smtp.myserver.com -From firstname.lastname@example.org -Attachments #myResultsFile#