Monitor which process and which user modified a file - windows

I'm trying to solve a problem where an xml file gets modified.
I want to determine which process and user is modifying this file.
I was thinking of more like using Powershell to subscribe to a file modified event. Once that event occurs, it triggers some code which outputs the details about the file modification (time, user, process etc.) to an output file.
I tried using the FileSystemWatcher, but it doesn't return required info about the user/process which modified the file so that wasn't sufficient for me.
Does there exist such an event class which I could subscribe to which will trigger an event when the file gets modified and also return which user or process modified the file and when.
If nothing works, the last resort is using the Windows Security Audit Logs which generates events when the file was modified and I can use powershell to parse them.
Thank you!

Related

How to check if a csv file has been uploaded in a drive daily and alert user if not?

I have been assigned a task of automating a manual activity which involves checking if a particular data file has been uploaded in a drive daily.The file is a .csv file added incrementally(once) every morning and named based on the date and time it has been uploaded.
In case the file is not present in the drive folder there should be a trigger alert to the stakeholders in the form of email.
What are the automation tools I can use to automate this particular activity?
My current plan is to write a java code that checks the folder.Using Jenkins I will run it everyday and trigger email alert in case a particular file is not present.
Is there any easier way to do this?

How can I create a Slack command with a file attachment

I would like to create a Slack command /command do-something-with-that-file with at the same time, the user uploading the file.
So far, my command is received but there is no files in the payload.
Is this possible?
I have also added files:read in the scope but no luck so far.
A Slack command can only accept text as input. If you upload a file at the same time, it wouldn't be a part of the payload and will be ignored (although uploaded, and accessible through file browser).
Some alternatives you could try though:
Use files.list method - Look for files uploaded within a few seconds of the moment when you receive the command. The method accepts ts_from and ts_to parameters for this purpose.
Use file_shared event - Subscribe to this event in your app configuration. This event fires every time a file is uploaded in a channel visible to your bot. You could ask the app user to use a certain format to provide with a file upload, and look for a pattern in the event submission.
Use message shortcut - Once a user uploads a file, you can ask them to use the context menu to fire a message shortcut associated with your app. This message shortcut contains a reference to the message ID, which can be used to fetch the uploaded file.

How do I start workflow session only when the indicator file show up? (Informatica)

What does this mean to start the session only when an indicator file show up for the workflow? Where do I create the text file and how do I insert it to the session? Also, what type of content should be in the text file? I'm quite new into informatica so I really need help... It is because everytime I want to start the session, I would right-click to start the workflow..
Use Event wait taks and set it to wait for a file you're expecting. There is a downside: you can only monitor for a file with a predefined name, there are no wildcards allowed.
Here's more: https://www.tutorialgateway.org/event-wait-task-in-informatica/
What does this mean to start the session only when an indicator file show up for the workflow?
This means there is a dependent file that must be present before the session in workflow is triggered.
Where do I create the text file and how do I insert it to the session?
You should create the text file in a location on Informatica server that workflow can access. You will want to use an event wait task placed prior to session. In event wait task, you'll specify the location and filename that must be present before event wait task succeeds.
Also, what type of content should be in the text file?
The file can be blank since it is a trigger file.

Trigger event for new file in Netsuite File Cabinet

I'm new to SuiteScript. Is it possible for SuiteScript 2.0 to create a trigger to start some funcionality as soon as a new file is uploaded to a particular folder in Netsuite's File Cabinet (by web services or manually by drag and drop zone)?
Thanks in advance for helping me out.
I do not see that a server side User Event script can fire for the File object like it can for so many other objects. It is not listed in the "Applies To" field for a script's Deployment record.
Additionally, Workflows have a similar field called "Record Type", and it is not listed there, either.
If you are creating File objects via SuiteTalk, you can execute logic after the "add" method is executed synchronously, or you can call a RESTLet if you would like to execute logic server-side in NetSuite.

Where should I store my log file so a user has write permissions to it?

I currently store my log file in the Program Files\My App folder but some users don't have permission to write here if they are not a power user or administrator. Is there a common location for this type of log file?
Update:
I'm currently using Application.StartupPath.
logFileLocation = System.Windows.Forms.Application.StartupPath;
I'd use Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) and then Path.Combine that with ApplicationName\Version\LogFileName
I would use the temporary folder.
Use the function GetTempPath on the Windows API,
or Path.GetTempPath in .NET
Instead of writing to a log file, write to the event log. It's managed by a system service, so you don't have to worry about any particular user's storage permissions. If you write to the general application event log, then your application's messages will be mixed with everything else from the system, so when you request the logs from your customer, you'll get to see what else was happening on the system when your application failed. You can also write to an application-specific event log.

Resources