login to remote windows machine through batch file from another windows machine - windows

My remote windows server restarts at fixed time , i need to login daily after restart , since i have scheduled few tasks in the server and they run only when loged in , please help me to automate the login process , can we do this through batch files ? like we can do the restart

If you have Windows 2008 or above you can use Task Scheduler. Open Control Panel and run the Task Scheduler. Right click on Action menu and run Create Task. Create the task as usual select "Run whether user is logged on or not" and (if need) select the "Run with hightest privileges" checkbox. Then go to Triggers tab and click the "New" button. There are many conditions for run this task. Select "At stratup" and click OK. Then in the Action tab select the "New" button. There select in Action "Start a program". Click Browse button and select your script or batch file. Click OK. Repeat as necessary. Click OK again and create the new Task.
Good luck.

Related

How to Run a Windows store app at startup if "open file location" option is not available?

While tryng to get the app "Maister Task" to run at startup I ran into the issue that, if the app is not already displayed in the startup manager, the method shown by the Windows 10 documentation to run apps at startup states that "If there isn't an option for Open file location, it means the app can't run at startup."
Is there a workarround?
One possible workarround:
open "Run" (Windows key + R)
Type: shell:AppsFolder
Locate the app that you want to run at startup.
Right click on app icon and select "Create shortcut"
Select destination of the shortcut.
Open "Run" again and type shell:startup
Add the shortcut that you created in step 4 to this folder.
Now the program will be launched when Windows is started.

VBscript SAP loose focus by Task Scheduler

I've got a problem i can't pass by. I have a script that is generating table in SAP and exporting is as spreadsheet and saving in proper location. It works perfectly when I do it by double-clicking on file, but it can't finish script via Task Scheduler in the moment it's exporting file from SAP in 'Save As' window. Script opens 'Save As' window on exporting and just SendVkey Tab Tab Tab Tab Tab, paste proper file location, Tab and Enter.
I figured out it works when i run it through Task Scheduler and simply click on SAP while script is running so it gets focus and everything is ok. And if I just run it by Task Scheduler and don't do anything it seems like it's working in background and SAP doesn't have any focus so my TAB keys are going somewhere else on windows (probably desktop) instead of going in 'Save As' window properly. The same story is when i Run file by double-clicking and minimize folder where the script is. It looks like SAP looses focus again and my TAB keys are not working.
So script is only working when i double-click it and don't do anything or when i run it by Task Scheduler and click on SAP window to give it focus. Is there any way to bypass it? Can i somehow simulate click on SAP window when script is running automatically or do i have to change something? I tried many ways, but i'm a beginner and can't figure it out.

Counting computer login times for the week

I am probably asking this question in the wrong place (Maybe I should go to an OS forum) - but I still want to know this.
I am using a windows- 7 machine for my work. I log in everyday, do some work and then log off. I take a few short breaks in between when I Lock (Windows+L) my laptop.
I have to account for the number of hours worked by the end of the week which means the time for which I was logged in to this machine.
The problem is that I do complete all the work that is assigned to me, but I forget to keep track of the exact hours I was logged into this machine. I may have logged in at 5 am in the morning and then logged off at 3 in the afternoon- and I dont have any manual logs of my time.
Is there someplace where windows keep a weekly track of
Say per day:
"The Latest log-off time - The Earliest Log in time" into that system for a particular day. I only need these logs for a week.
any heads up would be appreciated. Thanks
I have tried to solve this problem for years, but only recently found a solution that:
May be implemented without administrative privileges
Does not require extra software
Kudos to Guiding Tech for providing the solution shown below. Change the suggested folder and filenames as you desire, but adjust the batch file code and Task Scheduler commands accordingly.
Part One: Create the script
Create the folder where you would like the script and text log file of login and lock/logoff to reside. For this example, I will presume the desired folder is "C:!Scripts\Login\"
Create a new text file in the folder and name it login.bat. A quick way to do this is to right-click a blank space in the folder view, and select New > Text Document, then name it login.bat.
Open the text file and copy and paste in the following code:
echo off
set datecode=%date:~-4%-%date:~7,2%-%date:~4,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
if "%1"=="i" echo %datecode% - Logged in >> C:\!Scripts\Login\login.txt
if "%1"=="o" echo %datecode% - Locked computer >> C:\!Scripts\Login\login.txt
Save the new batch file
Part Two: Create the login task
Open Task Scheduler. Press the Windows key, and then type "Task Scheduler" and click on the application that appears with that name. Alternatively, use Start > Run (Win + R), type taskschd.msc and press Enter.
Select Create Task... from the actions on the right hand side
Enter a task name like "Log the login date and time"
Click on the Triggers tab and add a new trigger. Select:
Begin the task: At log on
Specific user: This should be your Windows account name.
Click OK to add the trigger.
Add another trigger, except this time select Begin the task: On workstation unlock. Click OK to add the trigger.
Click on the Actions tab. Add a new action and point it to your login script with the argument i.
Click OK to add the action.
7. (Optional – Only required if you are using a laptop) Click on the Conditions tab and uncheck the box that says Start the task only if the computer is on AC power. Click on OK to create the task.
Part Three: Create the lock task
In Task Scheduler, select Create Task… from the actions on the right hand side.
Enter a task name like Log the lock date and time.
Click on the Triggers tab and add a new trigger. Select:
Begin the task: On workstation lock
Specific user: This should be your Windows account
Click OK to add the trigger.
Click on the Actions tab. Add a new action and point it to your login script with the argument o.
Click OK to add the action.
(Optional – Only required if you are using a laptop) Click on the Conditions tab and uncheck the box that says Start the task only if the computer is on AC power. Click on OK to create the task.
Part Four: Testing that everything is working as expected
Your work is now complete. You just need to test that everything is working as expected. Just lock your computer by hitting WIN+L and log back in. If you followed the instructions properly, you should now have a file called login.txt in the same folder as your script. This file should contain a log of each time you log in and out of your computer.
You can use the event log to check when you logged in and logged put (or locked the PC for that matter) but you would have to do that by hand.. You could write a program to do that but that would be hard.
BTW: You will need to enable a group policy or something to enable login events. Have a look here

Console Application with task scheduler

I have created a console and I want to run it every 1-minute nonstop
I try to put in a scheduler task but I think that my configuration is done badly can someone help, please?
I want to finish this task
thank
You can follow the tutorial here How to Create a Automated Task that Runs at a Set Time in Windows 7
The steps outlined are as follows:
Open up Task Scheduler by either typing "task" into the Start Menu search bar, or by opening All Programs -> Accesories > System Tools.
Select 'Create Basic Task' from the right hand pane and the 'Create Basic Task' Wizard will open.
With the Wizard open, type a 'Name' and 'Description' for your new task and click Next.
NOTE: The Next button will only be accessible once a 'Name' has been entered.
Select the event/task to run DAILY and click Next.
Select the time as 00:00 and date at which you wish the first task to start (each task afterward will run based on your selection in step 4) then click Next.
Choose the action you with the task to execute from the list then click Next.
NOTE: For your query, select 'Start a program'.
Click 'Browse' and navigate to the executable (exe) file of the console app you wish to run then click Next. You can choose to ignore 'Add arguments' and 'Start in'.
Review the task and make sure that you've set all your required information correctly. If satisfied click Finish.
Click the Advanced button on the Schedule tab. There is a checkbox for Repeat task. The default is every 10 minutes. You can change that to 1 minute.
The key here is to find the advanced properties. If you are using the XP wizard, it will only offer you to launch the advanced dialog once you created the task.

Easiest way to make perl application for windows run on startup in code

What is the easiest way to make a perl app run at startup in perl code?
For example: to copy it to the "allusers" startup folder. How do I do this?
Use Task Scheduler. In Windows 7 (older Win versions are very similar):
Start -> All Programs -> Accessories -> System Tools -> Task Scheduler
Top menu: Action -> Create Task. You will get a task configuration window.
Specify a name
Choose the radio button: Run whether the user is logged on or not
Click on the checkbox: Run with highest privileges (if necessary)
Select the Trigger tab on top. Click on the New button.
From the Begin the task drop down, select At startup.
Select the Action tab on top. Click on the New button.
The Action drop down must specify Start a program. Browse and select your Perl script. Add any arguments if necessary.
The other tabs can probably be left alone. But this is the cleanest UI for creating a start up program. I believe you can also edit the registry and specify start up programs/scripts to run there, which is pretty standard practice for installation scripts.
Hope this helps.

Resources