Windows Server 2019, unable to terminate process: access denied - google-chrome

I mistakenly opened dozens of chrome.exe and chromedriver.exe processes and need to terminate them. I run:
Taskkill /IM chrome.exe /F
Taskkill /IM chromedriver.exe /F
and killed few. Most of them return: unable to terminate process: access denied (translated from italian).
I tried to terminate the single processes with no success, for istance:
taskkill /s servername /PID 9512
The user I'm logged in with is a "local account" and "Administrator". I tried to grant the user access via properties, security, users and groups, complete control to the user, nothing.
If I terminate the processes one at a time using task manager it works for most (I get the same error for few), but I really need to kill them all at once without rebooting.

Related

Batch file MySQLdump erroring While Computer is Locked

I am attempting to have a batch file run every night at midnight (via task scheduler) so that a backup of my mysql db is generated (using mysqldump), encrypted (using 7-zip), and moved to the appropriate folder. I modified a version of the code found at: https://sqlbackupandftp.com/blog/how-to-automate-mysql-database-backups-in-windows. The following is my modified version:
rem credentials to connect to mysql server
set mysql_user=***********
set mysql_password=***********
rem archive password
set encryption_password=***********
rem backup storage period (in days)
set max_keep_days=7
rem path to backup compression utility
set seven_zip_path=C:\Program Files\7-Zip\
rem backup file name generation
set backup_name=C:\Users\**********\Documents\Temp\all-databases-%DATE:~-4%-%DATE:~4,2%-%DATE:~7,2%-%time::=.%
rem backup creation
mysqldump --user %mysql_user% --password=%mysql_password% --all-databases >> %backup_name%.sql
if %ERRORLEVEL% neq 0 eventcreate /ID 1 /L APPLICATION /T ERROR /SO mysql-backup-script /D "Backup failed: error during dump creation" && exit
rem backup compression
"%seven_zip_path%7z" a -p%encryption_password% %backup_name%.zip %backup_name%.sql
if %ERRORLEVEL% neq 0 eventcreate /ID 1 /L APPLICATION /T ERROR /SO mysql-backup-script /D " Backup failed: error during archive creation" && exit
rem delete temporary .sql file
del %backup_name%.sql
rem copy backup to storage
robocopy C:\Users\**********\Documents\Temp\ C:\Users\**********\Desktop\Backups\ /e
rem local backup copy
del %backup_name%.zip
eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO mysql-backup-script /D "Backup successful"
(I removed the network path sections, as I am first trying to focus on getting this to run locally before re-incorporating those sections. Also, the backup_name variable didn't work until I used a full path)
This code does properly run when I run this myself, while logged in, etc. However, if I lock the pc, as I did last night, the file ran but failed once it reached the mysqldump line.
The inclusion of %TIME% variable worked when the time was after 12pm, but after midnight and in the morning there suddenly was an extra space in the file name which caused an error.
(to those who are having similar issues, please see Mofi's replies as they will seriously help you out)

0x2 error in task scheduler windows 7 mysql

I'm trying to do mysql batabase dump periodically through task scheduler. When I run the following query from command prompt, it gives me the dump. But, when I'm running through Task Scheduler, it's not working.
Query
C:\xampp\mysql\bin\mysqldump.exe --user=root --password=root --host=localhost --database gm > E:\backupgmdb\gm_backup_%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.sql
Task Scheduler error -
0x2 error screenshot
Task Action Definition Screen Print
make .bat file, let say c:\xampp\mysql\bin\backup.bat and execute it from scheduller. put into .bat file this commands:
c:
cd \
cd C:\xampp\mysql\bin\
C:\xampp\mysql\bin\mysqldump.exe --user=root --password=root --host=localhost --database gm > E:\backupgmdb\gm_backup_%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.sql
Plus, read this: https://serverfault.com/questions/734035/running-a-batch-file-from-task-scheduler-without-user-being-logged-in
The Task Scheduler in Windows Server 2008 R2 and later and Windows Vista and later executes tasks under a "least privileges" security context by default.
Open the properties of the task and check Run with highest privileges. Press OK, then enter the password for the administrative account when prompted. This will override the default "least privileges" behavior and will allow the task to run with administrative privileges.

How to navigate to MySQL prompt using cmd without setting environment variable or without navigating MySQL service folder in Windows

I want to run bat file in mysql prompt automatically in all computers without setting environment variable path.
I am using Xampp server,but some of my friends using Wampp and MysqlServer. However I want to run my sql commands by running a .bat file.So I want to navigate to the MySql> prompt first.
I tried following CMD command to find the service,
tasklist /svc >mysqld.exe
but I can't navigate to mysql>
Help me if someone has any solution. Thanks.
This would do the trick:
for /f "tokens=3 skip=3" %a in ('tasklist /svc /fi "imagename eq mysqld.exe"') do #cmd /c sc qc %a ^| findstr PATH

Monitor progress when running MySQL queries from command line in Windows using a batch file

I'm running MySQL queries from within Windows command prompt by utilizing a batch file.
The file contains:
#echo off
cd "c:\Program Files\MySQL\MySQL Server 5.6\bin"
echo Please type the root password
set /p password=
mysql -uroot -p%password% < C:\Temp\GenerateDB.sql
echo Please wait while script is executing and when finished successfully
Pause
mysql -uroot -p%password% < C:\Temp\UpgradeSchema.sql
echo Please wait while script is executing and when finished successfully
Pause
Exit
My only problem is that I cannot know if the first query (GenerateDB.sql) is complete or not in order to proceed to the next one(UpgradeSchema.sql).
Is there a way to get a prompt when it is complete or even better track real time progress as when you run the script from MySQL Command Client?
Many thanks in advance

Main user can't edit or run script, cronfile in SSH

I have a VPS with Intel XeonCPU E3-1270 V2 # 3.50GHz running on OpenVZ Webuzo + nginx
I used to edit cronjobs or other files as the main user via SSH. But it seems that I've lost all the privilege after restarting MySQL to fix a sudden CPU usage spike.
I get these errors when opening, accessing or saving files:
"user is not in the sudoers file. This incident will be reported.”
[user#vm root]$ php info.php
Could not open input file: info.php
[user#vm root]$ vi hello.text
E212: Can't open file for writing"
And when I run crontab -e and crontab -l, they return nothing. They just show:
[user#vm root]$ crontab -e
[user#vm root]$
Not sure if it has anything to do with me restarting the server, httpd, and MySQL. What should I do to get back the privilege back to the main user?
[user#vm root]$ php info.php
Could not open input file: info.php
[user#vm root]$ vi hello.text
E212: Can't open file for writing"
It seems you are logged in as the "user" and your current location is /root.
You are allowed to write contents to /home/user and not /root if you are logged in as the "user".
And when I run crontab -e and crontab -l, they return nothing.
Possibly your CRON service is not responding for some reason.
Re-installing the service will be a quick fix.
What should I do to get back the privilege back to the main user?
su -
and fill in your root users' password to get you privileges.
Good Luck