Skip to main content

Posts

Showing posts with the label Task Scheduler

PowerShell get startup items or files

Checking startup items or files, when Windows is starting or upon user successful login is quite important.
Some files need to run on startup so it can be used while the user or computer is being in used.
Or the startup files is set, so when the computer starts the file or items will also start. In this way, you don’t have to remember what things to open when the program or items will run during startup.
Of course, it’s not only the important files will be set during startup. Some viruses or malware sometimes use this method to load the software, so that they will also be in the system as long as the user is logged in.
So, how to check in PowerShell to get all those startup items or files?
Here’s the code:
Get-CimInstanceWin32_StartupCommand|selectDescription,Command,Location,User,Caption
Sample output:
Description : OneDrive Command: "C:\Users\duser_name\AppData\Local\Microsoft\OneDrive\OneDrive.exe" /background Location: HKU\S-1-5-21-abcdef-007-corona-2020\SOFTWARE\Microsof…

Robocopy backup using Task Scheduler

Backup is a simple word that has a very good significant value in today’s digital world.

Unattended backup or automated backup is a good strategy, so the user or the whoever is managing the backup won't need to manually trigger the backup.
No data backup is a head-on strategy, that leads to catastrophe.
Backup is very, very important in today’s digital world. You will never know when a data disaster will strike.
The whole laptop will be lost, the hard drive will fail without any sign, a virus might corrupt the whole system or just simple mistake to overwrite or delete a data. All this scenario requires a backup rescue to recover the data.
Robocopy is a built-in command in Windows that does a pretty awesome job to backup or copy files.
Using Windows task scheduler, robocopy and Vbscript will create an important task to backup data.
How the three tools will be used, to backup data?
Robocopy – to backup or copy the files Vbscript – to hide the robocopy in the background while Roboc…

Access denied renaming shared folder

If you are working in a shared active directory environment and has a shared folder that needs to be renamed once in a while.
But every time you want to rename there is always a user who is using the folder and therefore, renaming the folder is denied.
How to rename the folder when the shared folder is always in use?
Automation will come for the rescue in such a scenario.
How to automate renaming the folder?
Task scheduler and a simple batch file can do the task and a life saver.
Here's how to do it:
Of course, disconnect all the open files. Users should shutdown their computers when they went out of the office,
If they don't shutdown, force their disconnection by using the command below:
openfiles /disconnect /o read/write openfiles /disconnect /o no access
Then, rename the folder with the ren or rename command of course.
Syntax is the good old fashioned source folder or path and the new folder name.
If the batch file will be run directly on the server, then the drive letter w…

Task Scheduler query last run result remotely

Check remote computer task scheduler results and settings via command line.

It's quite hard to check one by one each server or computer whether task scheduler has run successfully or not.

To make life easier, query the remote computer or server remotely and check task scheduler result.

One liner command below will list the task scheduler settings and also its results in a nice and readable format.

/v - is for verbose so it will include all settings and of course the last run result.

schtasks  /s /query /v

It would be better to have the result in a text file so it can be easily read and also keep for record purposes.

  schtasks  /s /query /v  > Machine01_Task_Result.TXT


The command above will not display the result on the command prompt but redirect the result to the text file.

Tested in Windows 2012 to query Windows 7 client.

Tested in Windows 7 to query another Windows 7 machine.

The command should be run with proper privileges in order for the query to be successful.



Cheer…

How to lock computer after inactivity