I want to disable auto-updating on Windows 10.
I found out that disabling the service "WINDOWS UPDATE" will do this.
It did for some time, but when ever i restart my system it enables itself again and again. So I created batch file that disables it.
#echo off
NET stop "Windows Update"
I put it in startup folder but it worked only if it is executed as administrator. I tried to set properties of the shortcut to "RUN AS ADMINISTRATOR" but it stopped executing on startup.
Then I read about Task scheduler and added this task there but still its not working there even it just shows "The Directory Name is Invalid. (0x8007010B)
Related
My batch file is very simple. It starts a program, and echos "I ran" into a .txt file to prove that it ran for testing purposes. The settings for my Task Scheduler task are below:
General:
- Run whether user is logged in or not.
- Run with highest privileges
- Configure for Windows 7, Windows Server 2008 R2
Trigger:
-At startup, 15 min delay
Action:
- Start a Program
- Program/Script: STARTRDM.BAT
- Add arguments (optional): blank
- Start in (optional): C:\Scripts\
Conditions: None
Settings:
- Allow task to be run on demand
- Stop the task if it runs longer than 1 hour
- If the running task does not end when requested, force it to stop
- If the task is already running, , do not start a new instance.
STARTRDM.BAT
>>log.txt echo I RAN
start C:\"Program Files (x86)"\Devolutions\"Remote Desktop Manager"\RemoteDesktopManager64.exe`
If I double click the batch file, it starts the program as expected and also writes to the .txt file. If I run the batch file through the Task Scheduler, the .txt is appended to as expected but the program is not started. This is driving me crazy!
Well, I figured it out so I thought I'd post the solution.
The station I was working on is set up as a Kiosk. The Kiosk account is what is usually logged in on this system. I was using a separate Admin account to author the tasks in Task Scheduler because Kiosk didn't have the necessary permissions. By default the field, "When running this task, use the following user account:" gets set to whichever account you are running Task Scheduler as. When I switched this field to the Kiosk user, it fixed my problem.
I have a Windows XP virtual machine that I am using to run a legacy app. I am using a limited user account.
I have created a batch file that I'd like to:
Start the legacy app
Wait for the program in step 1 to close
Shut down the computer
So this is the code I am using (in this example, I am attempting to open notepad):
#ECHO OFF
start /w notepad
%windir%\system32\shutdown.exe -f -s -t 1
Because the legacy app needs to be run under an account with administrator privileges, I then manually created a scheduled task in Task Scheduler to run the batch file. The scheduled task is set to run using an account named Admin that has administrator privileges.
I am having a bit of an issue. When the scheduled task runs, nothing appears on the screen. However, I did notice that both cmd.exe and notepad.exe appear in Task Manager as processes running as the user Admin.
What am I doing wrong? How can I accomplish what I'd like to do? Thanks!
Sorry all, it was an issue with me not having Task Scheduler set up properly. I found this post which suggests to use the AT command to run the task interactively. This allows the Cmd window to be displayed when a batch file is run as a Scheduled Task.
I'm attempting to create a batch file that I can use with Task Manager in Windows 7 to copy users' local Google Earth file to a network location where it can be backed-up. It appears that the BAT is running just fine, but the task does not complete or stop once it's done & continues to show a status of "running".
Thanks in advanced for the suggestions!
COPY/Y "C:\Users\lena.domain\AppData\LocalLow\Google\GoogleEarth\myplaces.kml" "\\server\u-users\Lena\system backup\Google Earth" cmd.exe /C
Running your single line in a command prompt window results in error message: syntax error
Reason 1: There is no space between command COPY and option /Y.
Reason 2: There is cmd.exe /C appended at end of the line.
Use in your batch file the line:
COPY /Y "C:\Users\lena.domain\AppData\LocalLow\Google\GoogleEarth\myplaces.kml" "\\server\u-users\Lena\system backup\Google Earth"
And additionally make sure that this job is executed from task scheduler with credentials (account) which has the permission to write something on server. The local SYSTEM account often used for scheduled tasks has surely no permissions to access files on the server at all. It looks like the best account to use for this scheduled task is the user account of lena.domain. See also Configure a Scheduled Task Item (At least Windows 7)
I am trying to create a batch file to run an unattended installation of Adobe Reader 9 (it is a MSI file)
My problem is with the UAC. If I make a command like this:
msiexec.exe /i "AcroRead.msi" EULA_ACCEPT=1 ALLUSERS=1 /passive
The installation runs fine, except that I have to accept the UAC before it does anything. If I replace the /i with /a, it skips the UAC, and it seems to be installing, but when it finishes, it didn't install the program at all! No error message or nothing, it does not show up on add/remove programs.
Might it be that it installs to the wrong profile if I use the /a switch?
I am very new to scripting, so most of the info I have is what I can scavenge from google.
I know there are ways to disable the UAC from the batch, but if possible I would like to avoid that.
I am doing this on a virtual Win7 x64 sp1 machine.
Any software installation should prompt for admin credentials regardless of whether you launch the installer via the batch script or double-clicking the AcroRead.msi file in Windows Explorer. This is how permission on Windows works, and to be honest, I wouldn't want a system that could be bypassed via a terminal WITHOUT prompting for credentials. I don't believe there's any way around this.
Try removing /passive, since maybe that is suppressing an error message. Also insert a pause statement at the end of your batch script so you can read the error message before the command prompt is closed.
Edit:
Run the batch script as an administrator. This is different than running msiexec with the /a command. This will open the UAC prompt at the beginning of the script, and if authenticated, the rest of the batch file will be run with admin privileges.
/a is not used for a normal installation. It will generate an administrative installation. A "network" installation to allow other users to install from a common repository.
I would like to start a powershell script if the Server turns on. No dependency on the user and if a certain user logs out the program should continue working.
I tried an entry in the registry with the HKey_localMachine but my program won't continue working if a user logs off. Maybe there is a solution with the Task Scheduler?
Task scheduler is an option. Maybe run it with system-rights instead of admin
One shot in the dark is to have a scheduled task run a program/cmd.exe/powershell script as system on startup or user logon.
The command for starting on startup should be this:
schtasks /Create /TN taskName /SC onstart /TR powerShellScript.ext /RU system
Where powerShellScript.ext is replaced by whatever your script or other file is.
That should run whatever replaces powerShellScript.ext as system, thus preserving the process even if no users are logged on.
Another option is to launch the script once using a service as soon as it's started, but I don't have experience with that.
This might not work depending on how the file is launched. the most reliable method is to launch an executable and set the launch options to load whatever it is that you actually want.