boydosborne
asked on
RUNRMTCMD
Hello,
I am trying to run the following batch file from a CL program on the AS400. The batch file copied a text file to the iSeries IFS and then I import it into a database table. The program appears to run, but the file is never showing up on the IFS. I have checked my job lock and it shows that the program completed but with no results. Is there anything wrong with the way I have the RUNRMTCMD written?
RUNRMTCMD CMD('c:\Program +
Files\AscentSS\AscentSV\DA TEDSPLY.BA T') +
RMTLOCNAME('10.202.120.113 ' *IP) +
RMTUSER(*NONE)
My user ID and password are the same between the iSeries and the server.
I am trying to run the following batch file from a CL program on the AS400. The batch file copied a text file to the iSeries IFS and then I import it into a database table. The program appears to run, but the file is never showing up on the IFS. I have checked my job lock and it shows that the program completed but with no results. Is there anything wrong with the way I have the RUNRMTCMD written?
RUNRMTCMD CMD('c:\Program +
Files\AscentSS\AscentSV\DA
RMTLOCNAME('10.202.120.113
RMTUSER(*NONE)
My user ID and password are the same between the iSeries and the server.
About the RUNRMTCMD; do you have enough authorization on the remote server?
doesn't the remote server require an user id and password?
doesn't the remote server require an user id and password?
ASKER
I am wanting to call a PC batch file. The system does require a user ID and Password. I was reading the documentation on the User ID option within RUNRMTCMD and I thought that is you do not supply a user ID it will use your AS400 user ID and password?
I am trying to call a batch file on a PC server from a CL program on our iSeries. Is this possible with the RUNRMTCMD?
Thansk,
Chris
I am trying to call a batch file on a PC server from a CL program on our iSeries. Is this possible with the RUNRMTCMD?
Thansk,
Chris
try to store the .bat file on the IFS and use STRPCCMD,
with as parameter \\123.123.123.123\path\myb at.bat
That's the way I start some transfer jobs
with as parameter \\123.123.123.123\path\myb
That's the way I start some transfer jobs
ASKER
I am guessing that that the IP address in the STRPCCMD would be the IP address of the iSeries which is also the same iSeries I am running the CL program?
Thanks,
Chris
Thanks,
Chris
Yes you'r right
and if you loged in on the IFS then no extra login is required.
and if you loged in on the IFS then no extra login is required.
ASKER
This did not execute. Of course the batch file is trying to copy a PC text file that is in a directory on the server. I am not sure if this would impact the results or not. Here is what I have so far. I have a CL program that has STRPCCMD for the batch file that I copied onto the IFS folder ( Chris). The STRPCCMD is listed below. The original Batch file is still located on the server where I am trying to execute the .bat file. Does this sound like it shoudl work?
STRPCCMD PCCMD('\\10.202.120.216\CH RIS\DATEDS PLY.BAT')
STRPCCMD PCCMD('\\10.202.120.216\CH
Chris:
1) Is there an rexec server on the PC? I.e., what is on the PC that receives the remote command and executes it?
2) What are the rexec service attributes? I.e., assuming you have an rexec server on the PC, how is it defined to run? Does it run under the user account? Does it run as a different account? Does it discard commands that aren't authorized?
If you see no messages in the joblog on the AS/400 when RUNRMTCMD runs, then you need to review the system logs on the PC to find out what's happening. There might be entries in the Event Viewer for the security log, the sytem log or the application log. Or messages could be logged anywhere; you'll need to look at the documentation for your PC rexec server to know what to look for.
Most commonly, people use the iSeries Access Run Remote Command service. Most often, it needs to be tweaked to the proper configuration for the environment before it works. (Not unlike every other rexec server I've seen.)
Tom
1) Is there an rexec server on the PC? I.e., what is on the PC that receives the remote command and executes it?
2) What are the rexec service attributes? I.e., assuming you have an rexec server on the PC, how is it defined to run? Does it run under the user account? Does it run as a different account? Does it discard commands that aren't authorized?
If you see no messages in the joblog on the AS/400 when RUNRMTCMD runs, then you need to review the system logs on the PC to find out what's happening. There might be entries in the Event Viewer for the security log, the sytem log or the application log. Or messages could be logged anywhere; you'll need to look at the documentation for your PC rexec server to know what to look for.
Most commonly, people use the iSeries Access Run Remote Command service. Most often, it needs to be tweaked to the proper configuration for the environment before it works. (Not unlike every other rexec server I've seen.)
Tom
Chris,
STRPCCMD can only be used in an online session and it will work only on the PC having this session.
RURMTCMD is used in a session independent way and can run in batch, but as implied by tom's answer, you need a rexec service on the PC.
If you want the iSeries Access Run Remote Command service without requiring user and password, then you must modify its startup definition by adding the /nosecok switch to the service program.
Warning: This will create a gaping security hole on your windows machine.
Log in as administrator to the windows machine and run from command line
sc config Cwbrxd start= auto binpath= "C:\WINDOWS\CWBRXD.EXE /nosecok"
ShalomC
STRPCCMD can only be used in an online session and it will work only on the PC having this session.
RURMTCMD is used in a session independent way and can run in batch, but as implied by tom's answer, you need a rexec service on the PC.
If you want the iSeries Access Run Remote Command service without requiring user and password, then you must modify its startup definition by adding the /nosecok switch to the service program.
Warning: This will create a gaping security hole on your windows machine.
Log in as administrator to the windows machine and run from command line
sc config Cwbrxd start= auto binpath= "C:\WINDOWS\CWBRXD.EXE /nosecok"
ShalomC
Warning: This will create a gaping security hole on your windows machine.
What another one!!!!!!!
What another one!!!!!!!
ASKER
Client access is installed on the Server. I activate the iSeries Access for Windows Remote Command service. I was thinking that this would be used for the remote command from the iSeries server. I have found the REXEC.exe file in the WINNT/System32 directory. What is the command to setup this exe as a service. I tried the "service start rexec" command, but service does not appear to be a command. I also tried REGSVR32 "C:\WINNT\System32\rexec.e xe", but this did not work either. I cannot open the secutiry hole. This is not even an option, I will need to this configuration to be secured. Any assistance or advice is greatly appreciated and thank you for all of your feedback up to this point.
Chris
Chris
try
net start "iSeries Access for Windows Remote Command"
or
sc start Cwbrxd
or look in the services console for "iSeries Access for Windows Remote Command"
ShalomC
net start "iSeries Access for Windows Remote Command"
or
sc start Cwbrxd
or look in the services console for "iSeries Access for Windows Remote Command"
ShalomC
ASKER
I have the iSeries Access for Windows Remote Command started. This service was already configured for me, I guess it was setup when I installed Client Access Express. Is there an application log for this service that i can check and see what activity if any?
Thanks, Chris
Thanks, Chris
No application logs that I know of. Not even in the windows event log.
ShalomC
ShalomC
ASKER
Is there any file or setup any where that I can tweak the service to see if I can make it work. I think the code is fine, I just do not think I am taking to the server. Does any ports have to open on the server or does the Windows Remote Command service listen on a certain port. Is there a simple code set that I could put in a CL to test the communication with the server?
Maybe STRPCCMD(cmd)? If the command works then a DOS command shell should open correct?
Thanks,
Chris
Maybe STRPCCMD(cmd)? If the command works then a DOS command shell should open correct?
Thanks,
Chris
execute
RUNRMTCMD CMD('dir > c:\rmt2.txt') RMTLOCNAME('10.10.10.10' *IP) RMTUSER(chris) RMTPWD(password)
and look for the c:\rmt2.txt file on the server. If it is there and it contains the dir results, then you're ok.
ShalomC
RUNRMTCMD CMD('dir > c:\rmt2.txt') RMTLOCNAME('10.10.10.10' *IP) RMTUSER(chris) RMTPWD(password)
and look for the c:\rmt2.txt file on the server. If it is there and it contains the dir results, then you're ok.
ShalomC
ASKER
That actually worked, with the same layout of the above source. If i wanted to call a batch file, I would just simply have:
RUNRMTCMD CMD('C:\CHRIS\CHRIS.BAT') RMTLOCNAME('10.10.10.10' *IP) rmtuser(chris) rmtpwd(password)
RUNRMTCMD CMD('C:\CHRIS\CHRIS.BAT') RMTLOCNAME('10.10.10.10' *IP) rmtuser(chris) rmtpwd(password)
ASKER
Just for testing purposes I tried to copy a file. Below is the statement that I am using. The copy is not working. It is very frustrating that the dir > c:\test.txt statement worked, but changing it to copy c:\test.txt t:\ does not work. Any suggestions.
With the RUNRMTCMD, do I have access to all dos commands?
Thanks
With the RUNRMTCMD, do I have access to all dos commands?
Thanks
I can't check it now, but as far as I remember I never had such problems.
yes, you have access to all dos commands that the user you use has access to.
copy should be no problem.
try this
copy c:\test.txt t:\ > c:\err.txt
this will save all messages form the copy command to err.txt
yes, you have access to all dos commands that the user you use has access to.
copy should be no problem.
try this
copy c:\test.txt t:\ > c:\err.txt
this will save all messages form the copy command to err.txt
Chris:
Just to be certain, if you logon to that PC as chris/password and run [copy c:\test.txt t:\], do you need to do _anything_ else other than type the command on a command line and press [Enter] to make it work?
Tom
Just to be certain, if you logon to that PC as chris/password and run [copy c:\test.txt t:\], do you need to do _anything_ else other than type the command on a command line and press [Enter] to make it work?
Tom
Chris,
test your commands by using the native pc rexec client.
type rexec on a command line to figure it out..
test your commands by using the native pc rexec client.
type rexec on a command line to figure it out..
ASKER
I can execute any command once I log onto the server. I am actually an administrator on the server. I did change my logging for this command and I set user = %userid% within the batch file, just to see what would be returned to the iSeries joblog. I noticed that user was set to blank. Is this normal? Should the user ID from the RUNRMTCMD be in the %userid% field?
Thanks
Thanks
ASKER
reexec said that access is denied when I use my network user ID and password. I can type this command within dos and it works fine. Where would my authority to use commands be controlled? May I change any settings?
Thanks,
Chris
Thanks,
Chris
Chris,
we have an anchor - you succeeded to run a dir command.
try
RUNRMTCMD CMD('copy c:\test.txt t:\ > c:\err.txt') RMTLOCNAME('10.10.10.10' *IP) RMTUSER(chris) RMTPWD(password)
what does the err.txt file show?
ShalomC
we have an anchor - you succeeded to run a dir command.
try
RUNRMTCMD CMD('copy c:\test.txt t:\ > c:\err.txt') RMTLOCNAME('10.10.10.10' *IP) RMTUSER(chris) RMTPWD(password)
what does the err.txt file show?
ShalomC
ASKER
The err.txt is never created. The joblog on the as400 says access denied.
can you still run the remote dir command?
if you can, then try this command
cmd /C "copy c:\test.txt t:\ "
if you can, then try this command
cmd /C "copy c:\test.txt t:\ "
ASKER
Here are the results sent back from the command and also included is the command that you gave for verification. It is like the server is refusing my access. But I don't understand or know what the configuration is set to not allow this operation to work.
CMD('cmd /C "copy c:\test.txt t:\ "') +
Access is denied.
0 file(s) copied.
CMD('cmd /C "copy c:\test.txt t:\ "') +
Access is denied.
0 file(s) copied.
What server is it? win2000? win2003? do you have any restrictive group policy on the server?
ASKER
Win2000 there are not any restrictive group policies on the server
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The scheduled job worked fine. The batch file ran and it copied the required file.
Is the RUNRMTCMD not oly between 2 AS/400's ?
did you already tried the STRPCCMD
before it will work, you have to start the command STRPCO
Regards,
murph