| 1. |
Solve : How to copy & run batch file remotely? |
|
Answer» I have created one batch file on server, such that - you could try the following: Dear wbrost, I have created batch file on my server m/c, The operation of my batch file is like this, 1) I have log file in my server which records client login logout time, For particular user if the logout log is not exist(means application is still on & it is consuming license from the license server) then i am reading the clients last login time & date, 2) Checking the date & time difference with current date & time 3) If the time difference is greater than 8 hrs & date difference is greater than 1 day 4) Then, copy the killprocess.bat file from server to client machine & execute that batch file on client machine remotely to kill that perticular process. ----- killprocess.bat file has one liner code, cd\ taskkill /F /IM processname.exe ------ Issues/ Problem i am facing are, 1) for copying killprocess.bat from server to client machine requires shared folder on client pc. as said earlier my domain restrictions doesn't allow me to share folders in client pc. 2) even if i manage to copy the killprocess.bat file somehow, for executing that batch file remotely using PSEXEC command also requires the shared path where the killprocess.bat is located - How can i execute process remotely without having shared folder in client pc? is there any alternate to execute batch file remotely? I thing now i have explained my problem in more detailed. Eagarly waiting for the reply, Thanks in advance. 1) if you have access to the system you can map a network drive using the administrative share. example: \\computername\c$ this will give access to the root of the c drive on the system computername 2) using the at command you can schedule a remote task to execute at a specific time. The AT command schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the AT command. AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]] AT [\\computername] time [/INTERACTIVE] [ /EVERY:date[,...] | /NEXT:date[,...]] "command" \\computername Specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted. id Is an identification number assigned to a scheduled command. /delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled. /yes Used with cancel all jobs command when no further confirmation is desired. time Specifies the time when command is to run. /interactive Allows the job to interact with the desktop of the user who is logged on at the time the job runs. /every:date[,...] Runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed. /next:date[,...] Runs the specified command on the next occurrence of the day (for example, next Thursday). If date is omitted, the current day of the month is assumed. "command" Is the Windows NT command, or batch program to be run. if you still have questions please let me know.Dear wbrost, You are correct, but as i said earlier my domain client pc doesn't have share folders, instead the sharing permission is not exist. and i suppose the mapping drive is possible only if the client machine has the shared folders in it. pls correct me if i am wrong.there is actually a shared folder by default. This is called an administrative share. The administrative shares can be accessed by putting a dollar sign ($) after the drive letter. example for the administrative share for the C drive would be: \\computer\C$ to see if the system has the administrative share active do the following: Right click on my computer click on manage expand shared folders click on shares.Dear Wbrost, I'm getting following error while accesing those folders, Error 5: Access Is Denied. Is there any other alternate to copy file remotely (without sharing) ------ Can i make use of FTP for pushing batch file? But i suppose FTP doesn't pushes anything, somebody has to push data to him & Pull data from him, pls correct me if i am wrong. (If above happens through FTP, i can make use of AT command to schedule that batch script as suggested by you.)How are you thrying to access the computer when you get the error message? you can test access out side the command line by doing the following: click on start click on run type in \\computername\C$ when prompted enter the following: user name - computername\accountname password - password for account you need to make sure you are connecting as the account on the remote system. please see the below command switches for reference: NET USE [devicename | *] [\\computername\sharename[\volume] [password | *]] [/USER:[domainname\]username] [/USER:[dotted domain name\]username] [/USER:[[emailprotected] domain name] [/SMARTCARD] [/SAVECRED] [[/DELETE] | [/PERSISTENT:{YES | NO}]] NET USE {devicename | *} [password | *] /HOME NET USE [/PERSISTENT:{YES | NO}] |
|