MacOS Automator asks for permission every time - macos

I have an Automator script running on my Mac that, every Saturday at midnight, collects the data from my calendar and exports it to a txt file on my network drive. I have a linux computer that will, five minutes later, go to that location and do something with the data.
When midnight arrives on Saturday, however, I find that my Mac is trying to get my permission for Automator to access my calendar, contacts, and network drive. Even after I gave it these permissions, it still prompts me to run the program before it executes. Since I am dealing with time data, and the timing of the program's execution is important, is it possible to give automator some privileges in this regard?
I added a caffeinate script command to run before the program to prevent the computer from going to sleep, but this does not change the need for actively activating the time data script.

Related

Schedule script on windows so that it should always be running in background when someone logins

I am a beginner at developing Windows apps. I have created a VB script that executes the EXE file in background. I have referred some articles online and scheduled the script with windows scheduler. Now Every time I log in to the computer, the script starts running in the background normally as expected. The problem occurs when I lock the computer for a long period of time, somehow script gets killed by Windows. If I try to log in again, script(which got killed) doesn't start once again.
I want the script to run every time the computer gets unlocked no matter whether the computer was restarted/power-on/woke up from sleep and it should start running the script. But I am unable to achieve this.
This is what my current trigger looks like . Please tell me if I am doing something wrong

Make a PowerShell script run on startup in the OOBE Sysprep environment

Thanks for stopping by, I've searched the corners of the internet but haven't gotten anywhere.
To provision devices for my organization, we must manually run PowerShell commands using SHIFT + F10 in the Windows 11 OOBE as we have multiple methods, one of which being legacy. I'm sure there are better methods but I'm unfortunately working within these limitations. So far, to automate the imaging process, I've created an autounattend.xml which makes WinPE completely silent and some pages of the OOBE also.
Recently, I combined all the PowerShell commands we had been running prior into a script that, after running repeated checks for a network connection, prompts users with a GUI and effectively automates everything we had been doing manually before:
Message box with radio buttons
I need to make this run when the OOBE Sysprep starts, but I really need some help.
The script contains GUI, so it cannot run silently and the user needs to interact with it.
The script must start with the OOBE Windows Welcome Screen, (i.e. select region screen). This is a limitation of the modules used and I therefore can't include it as a synchronous command in FirstLogonCommands or include it in SetupComplete.cmd, as those both execute after the OOBE is completed.
I've tried configuring the answer file to boot into audit mode and have the script run there, but the script requires several reboots and I get an installation failed message after any reboot (despite later making the script enable the Administrator account and call "sysprep /audit /reboot"). Additionally, the Audit Administrator account takes ~15 minutes to log in so it defeats the whole purpose of time saving.
I've tried using Task Scheduler, running both on System Start Up and User Log On, as defaultuser0, BUILTIN\Administrators and SYSTEM. Task scheduler seems to either queue tasks or not call them at all in the OOBE
I've tried placing the script, and then a shortcut of the script, in the common start up folder but that didn't work either.
To reiterate, I need a way to automatically run a script when the OOBE Sysprep starts. Furthermore, I need it to run every time the OOBE is launched as sometimes, we have to manually reboot if something glitches or goes wrong so the script will need to run again when the OOBE is resumed.
I know this is a tough one due to the limitations, but this will make the device rollout significantly easier.
Thanks,
Jake

How to Check the Number of Times an Application has been opened on a Mac?

I have a script that imitates the war games logon and I was hoping to track the number of times an application has been open, so that way the script doesn't run every time I open a new terminal. Rather I would like it to run when I reboot the machine and open iTerm for the first time since reboot. Is there a way to track the number of times an application has been open since reboot? That way I can write a condition for an if statement.
If you want it to only execute once on boot, you could check for the existence (or not) of a specific file, and just touch it after it's opened for the first time, and delete it on shutdown or on startup before the full desktop/terminal window/environment loads in.

How to execute a missed cron or launchd job only once computer is connected to the internet?

I have a script that I want to execute daily, which requires an Internet connection in order to properly execute. However, my laptop (where the script resides) is not always on, and is not always connected to the Internet.
I want the script to execute at, say, 8:00am every day. However, if the computer is off or not connected to the Internet at 8:00, I want the script to execute at the next available chance.
How can I achieve this using cron, launchd or some other manager? Bonus points if the answer avoids having to fail the job every, say, 5 seconds once the computer turns back on, and until I connect to the Internet and it properly executes.
If it matters, I'm running OSX Mountain Lion.
anacron is probably your answer. It's usually installed on linuxes but is optional, and can be left off if your system administrator decided not to include it. On OS/X, it's a little more challenging, but there are pages on the internet explaining it better than I have room to here. Anacron running from launchd can be done.
On linux the man page should point you in the right direction.
Additionally you can make your script aware of the internet connection with a wget command and interrogate the results. If it's unsuccessful, go into a loop waiting for an internet connection to work with a timer of 10 minutes or whatever makes sense to you.
Hit me up if you need details of how to accomplish any of these tasks.

Scripting for safe file backup under windows

I need to back up some large files that are being written to disk by a process. The process is perpetually running, and occasionally dumps large files that need to be moved over the network. Having the process do this itself is not an option, as the process locks out users whilst it is doing file dumps.
So, this runs under a windows machine, and as a primarily linux user, I am not entirely certain how to do this...
Under linux I would simply use a cron job in the folder (I know the glob that will match the output files), then check lsof, to ensure that the file is not being written to, such that I don't try to copy a partially complete file. Data integrity is critical, so I would normally md5 the files before and after the copy.
So I guess my question is -- how does one do this sort of stuff under windows? I feel like I am kneecapped from the start -- I can use python, but I can't emulate lsof, nor cron to do the task scheduling.
I tried looking at "handle" -- but it needs admin privelidges at execution time, which is also not an option. I can't run the backup process as an admin, it has to run with user privs.
Thanks..
Edit: I just realised I could keep the python instance running, with a sleep, so task scheduling is not a problem :)
For replacing cron you can use the "Task Scheduler" in windows to start your script every few minutes (or specific times).
For lsof the question was discussed here : How can I determine whether a specific file is open in Windows?

Resources