Questions tagged [batch-file]
batch files are simple text files executed in a command to achieve a particular task or a set of tasks
75
questions with no upvoted or accepted answers
7
votes
0
answers
3k
views
Windows: 'Query User' command reporting idle time inaccurately (false positives)
I'm working with ten other sysadmins that sometimes forget to log out of servers (or even lock them). For two days or more, I've been trying to come up with a 'script' that'll check each server we ...
5
votes
1
answer
1k
views
Windows Task Scheduler cannot access EFS encrypted folder despite running as a user with access
I have a batch file set to run via Task Scheduler in Windows Server 2008 R2. The batch file is being used to rotate and compress MySQL logs, and the folder containing these logs is encrypted using ...
2
votes
2
answers
10k
views
Windows Server 2012 R2 Task Scheduler access denied (0x80070005), but command works manually in shell
I have the following problem. On our Windows Server 2012 R2 is a scheduled task which calls a batch file, which in return calls vb scripts.
Those scripts just download 5 pictures and stores them ...
2
votes
1
answer
1k
views
how to loop though sub folder to check if folder is empty - batch script?
What I want to do:
write a batch script to do the following
loop though all dir starting with "01-"...
Check if "Pictures" folder is empty or not. skip rest folders
If "Pictures" folder is Empty, ...
2
votes
0
answers
267
views
DSADD in batch file - syntax incorrect! Same command in command works fine
Really stumped here and I'm sure the answer is simple. Simply put, I'm creating a bunch of AD accounts based on input from a spreadsheet. I've been able to concatenate the fields into a DSADD command ...
2
votes
0
answers
1k
views
Trying to install PEAR (running go-pear batch file) - getting "php_pdo.dll is missing" error
I need PEAR installed. So, I tried running the go-pear batch file inside by PHP extract. But it gives this error -
The program can't start because php_pdo.dll is missing from your computer. Try ...
1
vote
2
answers
1k
views
Push out Commands to all Domain PCs
I'm looking for a way to push out commands to all workstations. The scenario is as follows:
I often go to environments that I am not familiar with to audit the network. Part of that is a network scan, ...
1
vote
0
answers
507
views
using start /wait for a headless process in a batch file - any way to show the process is running?
So I have a large batch file, and in the middle it hits a start /wait command to run a silent install of an MSI. I'd like to have some animation or something to indicate that the batch file is in fact ...
1
vote
1
answer
225
views
A Batch script to call virustotal api and add a windows firewall rule if a baddie is detected?
Basically, when I connect to any site, it loads not only stuff on that server, but also stuff like background images, scripts, icons, fonts from third party sites. I was wondering if it would be ...
1
vote
1
answer
730
views
Having issues with mkdir, robocopy, to date\time folders in a looping batch file
I have searched everywhere but cannot find a solution.
Im unsure what is going on here but I desperately need some help in regards to this issue,
Im running a batch file (Script for a game Server ...
1
vote
2
answers
239
views
Advanced PDF File Associations on Domain
I have a complex setup that I'm having issues getting to work properly. Microsoft is so aggressive at defaulting PDFs to Edge. Edge gives our organization so many problems when working with PDFs and ...
1
vote
0
answers
675
views
Do I need to have identical user account on different domains to run a net use command via batch script?
I have a Task Scheduler task that runs a batch file which copies a file from server1 to server2 on a different domain.
Note:The scheduled task is running on Domain_A using user accounts created to ...
1
vote
0
answers
38
views
How do I set up multiple unique accounts via command line?
I have to setup and configure about 60 (+ more in the future) windows 7 embedded PC's with the same settings. Each of these PC's will have 12 accounts on them. Each of the accounts will have their own ...
1
vote
1
answer
2k
views
Scheduler not working on windows server 2016 EC2 instance aws, while EC2 is running?
I have setup a few batch files to execute python scripts on window. I have confirmed the batch files work by double click them which lauches CMD to show the scripts running.
I have setup a task ...
1
vote
0
answers
738
views
TaskScheduler trigger on specific task
I have a backup service running through TaskScheduler.
The backup task runs a batch-file which does all the magic.
Sometimes the backup fails which fills a log table until the server becomes ...
1
vote
0
answers
1k
views
How to run cmd from PowerCLI Invoke-VMScript starting with an open console
I'm trying to run a exe file in a remote machine from PowerCLI which is launching couple of cmd's.
With this command:
$executeCommand = "call D:\MyFile.exe Arg1 Arg2";
Invoke-VMScript -VM $vmName -...
1
vote
1
answer
2k
views
How to catch "The system cannot find the file" within For /F loop?
How to catch "The system cannot find the file" within For /F loop?
I would like my code to do the following:
1 - Search for the specified file
2 - If file not found, handle the "The system cannot ...
1
vote
1
answer
9k
views
Clearing Out SCCM Cache On Client Machine Automatically
I would like to run a script that clears out the SCCM cache on a client computer automatically. To do this, I have written a simple batch file:
if exist %Windir%\ccmcache (
RMDIR %Windir%\...
1
vote
1
answer
4k
views
How to auto-run batch file as specific user (not scheduled task, not a duplicate)
I am an enterprise admin (Sr. Network Engineer), but my team does not manage Active Directory, so I am a little unfamiliar with policies and what is required to do what I am trying to achieve, and ...
1
vote
0
answers
76
views
Data Execution Prevention - Optout for the exe in “C:\Program Files\SSS\sss.exe” using Command Prompt
Can any one help me in adding "C:\Program Files\SSS\sss.exe" in DEP Exception list using Command Prompt?
1
vote
1
answer
2k
views
Do CMD scripts run faster than BAT scripts?
I recently heard from someone that Windows Admins should use CMD logon scripts over BAT logon scripts, as the run or execute faster. Apparently BAT scripts are notoriously slow.
I've done a bit of a ...
1
vote
0
answers
560
views
Running psexec on Windows Server 2008 R2 from Windows 7
I'm trying to successfully run a batch file located on a server pc (Windows Server 2008 R2) from my Windows 7 client PC. But its not working and the command prompt shows the following error ...
1
vote
0
answers
88
views
Losing stdout when process restarts itself in windows
I have for example a NodeJS process running with Nodemon, and all the output redirected to a file.
nodemon example.app > 123.log
When I change any file in the node app, the NodeJS process is ...
1
vote
1
answer
2k
views
Running multiple instances of a Batch file in windows simultaneously?
I have a windows batch file that is invoked by windows scheduler. When I try to have multiple windows scheduler tasks trying to run the batch file simultaneously, the batch file is locked by the first ...
1
vote
2
answers
474
views
iis 7.5 Website permissions
I'm trying to setup permissions on IIS 7.5 running in Win7. The instructions I found are:
Ensure all your sites have their own unique Application Pool assigned.
In the Advanced Settings under ...
1
vote
0
answers
909
views
Display only the last line of a windows command line executable
I'm trying to write a batch script that manages simple software deployments. One of the steps in the script compresses a file structure into a 7zip archive.
During the compression process, the z7ip ...
1
vote
0
answers
412
views
Mapping Drives for VPN using CMAK
I'm creating a connection file for VPN using microsoft CMAK. The VPN connection works but when I try to map drives it maps the drive under the Administrator account on the local machine because the ...
1
vote
2
answers
330
views
How to enable logs for execution of multiple URLs through cscript.exe & *.vbs bat file
I have multiple URLs to execute. I am currently using below method
I am creatving a vbs file with below content
Option Explicit
Dim objIEA
Set objIEA = CreateObject("InternetExplorer.Application")
...
1
vote
1
answer
2k
views
How do i create a bat file to create user directory with proper rights and a script to reset it if something goes wrong
I need to create user and directories for the user and share it.
The rights are set on NTFS structure only.
The user must do all except change rights and take ownership this is not allowed
and this ...
1
vote
1
answer
2k
views
Gracefully Terminate Console App Run Via Task Scheduler
I'm running a console application on Windows Server 2008. I want it to always run, so I have scheduled it to run at startup via the Task Scheduler. I set up the task so it does not require a login.
...
1
vote
1
answer
2k
views
How to check status of one port on remote host using NSClient++?
I know I could check for telnet on a known IP using other programs like:
nmap -A 192.168.0.1/32 -p 23
Or, look for open ports from 20 to 30 on host.example.com:
nc -z host.example.com 20-30
I need ...
0
votes
1
answer
202
views
How to run a batch script completely and automatically on event such as sleep/hibernate and shutdown event using task scheduler?
I have written a batch script to perform some folder synchronizing task. I have scheduled the script to execute using task scheduler on events such as sleep/hibernate(kernel power event id 42) and ...
0
votes
0
answers
592
views
How can I remove the first character of a variable from For and Tokens in a batch script?
With a batch script to set variable from For and Tokens and remove the first char:
for /f "tokens=1,2,3,4,5,6,7,8" %A in (
'net user %username% /domain ^|
find "Global Group ...
0
votes
1
answer
502
views
How can I redirect the output of one command in a batch file?
Edit: This question has been answered, please scroll down ⬇️
This question is related to Server Fault because I am automating minifying some web files before deploying them to my server.
So I have a ...
0
votes
0
answers
1k
views
"Invalid drive specification" when copying files
Currently using XCOPY via a BATCH file which I created, in order to copy files over from a client computer to a mounted drive created in Azure.
I have been using the XCOPY function for some time, ...
0
votes
1
answer
2k
views
Group Policy scheduled task for running .bat file applies, but task does not create
I am trying to add a scheduled task to run a batch file that updates / installs software. I created a GPO to create the task, using these settings:
Task Settings
Task settings 2
Task settings 3
For ...
0
votes
1
answer
952
views
Run batch file to start specific program to open at specific record
I need to be able to run a batch file that opens Access at a specific record. This I can do, but now I need to also run it on either 32 or 64 bit systems.
Our company uses a mix of systems.
This is ...
0
votes
0
answers
148
views
Best Method For Clearing User Data On Shared Windows Device?
I have had a client request that I setup a user account on a Windows device that will clear all user profile data once the account has been logged off. The computer is a shared device that will be ...
0
votes
0
answers
132
views
Why Would a Log File Get Cut Off When Emailed?
I am setting up some local backups of AWS EC2 instances. The backups are set to run overnight via Windows Server 2012 R2 Task Scheduler. The basic flow of each backup is that an rsync copies the ...
0
votes
1
answer
2k
views
running batch file as administrator privilege in clients with gpo(scripts/logon)
I want to run a batch file on all my domain clients via gpo(scripts/logon), but the problem is that to run a batch file, administrator privilege is required.
I wanted to know is there any command or ...
0
votes
0
answers
439
views
GPO to detect if application is installed, if not install it and then create log file
@echo off
IF NOT EXIST "C:\Program Files\APPLICATION_DIR" ( msiexec /q /i "https://www.SOME-WEBSITE.com/software/APPLICATION_NAME_x64.msi" LICENSE_KEY="LICENSE_KEY_GOES_HERE&...
0
votes
0
answers
721
views
Extracting multiple password-protected archives located in multiple sub-directories
There is a folder that contains many folders and subfolders, and each of these contains any number of password-protected 7zip archives. The password is the same for all of them. These are single-layer ...
0
votes
0
answers
97
views
How to automate a task on a server and upload output to an FTP server?
I have a process that works in the following way:
downloading data from the internet.
executing a program → creating output A.
output A → executing a program → creating output B
output B → executing ...
0
votes
1
answer
236
views
How to build a bat file or a VBS file in windows server that call external URL and save the result inside a variable?
This is what I like to achieve inside Window Server:
Call external URL: https://www.example.com
Save the result of that URL in a variable.
If the variable is XXX kill a process inside the Window ...
0
votes
2
answers
599
views
Replace empty spaces with a zeros in file name
Not a coder but know the logic like understanding a language but not able to speak it. Environment is Windows server 2016.
Trying to write a .bat file to replace empty spaces with zeros '0' in a file ...
0
votes
1
answer
3k
views
Get the previous day date as variable in batch file from powershell command output
The scenario is like this. I need a previous day date (i.e. Today -1) as variable in a batch file. But if previous day is Sunday (i.e. script running on Monday) it should return the Saturday's date (i....
0
votes
0
answers
494
views
Windows Update killed server reboot batch job. Is there a replacement?
I have been creating a scheduled task with powershell to use a group managed service account (the only kind allowed) on Window Server 2016. Did this approximately one year ago on 5 2016 VM's, and it's ...
0
votes
0
answers
1k
views
Scheduled task returns error 0xff but success
I have a scheduled task that runs a batch file, and even though I can see the results of it completing successfully, according to the task scheduler it fails with error 0xff, every time.
title ...
0
votes
1
answer
46
views
Running batchfile admin to set envirnment var
I am running into an issue here on Windows 10. I am trying to set an environment variable within the batch file using a for ... in ... do, but it never finds the file folder I am looking for.
...
0
votes
1
answer
316
views
Installing operating system from server PC to all the client PC
I am working on the project in which I have decided to install operating system from server PC to all the client PC.
I have one windows iso file on the server PC which is shared on the network.
This ...