So I have an existing procedure to install an updated version of software. During the procedure once the install completes an .ini file gets copied from the old install directory to the new one and a couple of lines are changed and the file is saved. I'm trying to find out if there's a way to email that .ini file to someone. Once the changes are made and the file is saved there's a couple of manual changes that need to be made by the person in charge. So ideally I'd like part of my procedure to email that file to him with the username in the body of the email. The username variable is easy enough to do, it's figuring out how to get SaaS Kaseya to send the file as an attachment when the procedure finishes.
Trevor - can the "manual" changes be automated? is the information to change available either on the system (such as current user ID) or able to be passed to a script?
We use INI files quite a bit and even manipulate two of they daily with software.
I have a small utility that I can call from an A-P and write data to a file/section/value, or read from a file/section/value. It's good for when you want to update just a few values. Here's an example of how it works:
The args, in order, represent action (R/W), file, section, value, and data.
C:\Temp>rmmkse rmuini.bms --A:W --f:.\test.ini --s:COMMON --v:Name --D:Glenn
C:\Temp>rmmkse rmuin.bmsi --A:R --f:.\test.ini --s:COMMON --v:Name
C:\Temp>rmmkse rmuini.bms --f:.\test.ini --s:COMMON
These can be run from an executeCommandLineToVariable. the return will contain FAIL-reason for any failure. As long as the result doesn't contain FAIL, it worked.
Specific values or entire sections can be deleted by specifying a write action with no data or no Section argument.
There is also a "Update" action that will merge the contents of one INI into another, either updating or adding values from one into the main.
I embed this into select procedures, so give me a couple of hours to create an example procedure, export it, write some notes and post it to the Downloads / Software section of my website. You might find it useful.
Unfortunately it's a unique change that's has to do with each specific user. I was trying to automate this as much as possible but the worse case scenario is the person who has to make the changes gets the file emailed to him by the user
You can read the file and send it to a variable, this won't be the actual file but will contain the contents of the file, if that works for you.
Will need to first format the file to a format that Kaseya can understand with this command:
executeShellCommand (type c:\pathtofile\filename.ini >> c:\pathtonewfile\filename_utf.result)
The read the result into a variable
getVariable("File Content", "C:\pathtonewfile\filename_utf.result", variablename)
Now you can call the variablename in the email
Unfortunately it's not going to. The .ini file goes to the person in charge to make the manual update and then emails the file back to the specific user to copy and overwrite the existing. And most of the users are not computer savvy. I had to use VSA yesterday to download the .ini from someone and email it myself to the person in charge because the user couldn't locate the directory to attach the file from. The kicker? The folder is in the root directory of C:\...
You may look at "transferFile" command. If the intended recipient has an Agent, it can be send without the "email" dependency.
I'll look into that. If it can uniquely name the file on the destination machine that'd be perfect.