runrmtcmd on WinXP

Tags:
AS/400
DataCenter
Microsoft Windows
PC/Windows Connectivity
I can't seem to get mapped drive operations to work from batch pgms on WinXP called using runrmtcmd. For instance, I have a .bat file that does a "dir c:". This works if I run the batch file from a command window on XP and it also works if I invoke it using runrmtcmd from an iSeries session or CL program. Now if I change the batch file to do "dir x:" where x is a shared folder on another PC or on the IFS, I get the error "The system cannot find the drive specified". I tried forcing a drive mapping in the batch file before the dir but then I get "System error 1312. A specified logon session does not exist ". I'm sure it's an XP permissions issue because this works just fine under Win98. Are there any Windows gurus out there that can help illuminate this issue for me? Thanks, Kevin

Answer Wiki

Thanks. We'll let you know when a new response is added.

I’m not necessarily a Windows guru, but… I was always under the impression that you needed to access virtual drives using the UNC path instead of the drive letter. As I understand it this is because the letter mapping is done as part of a user session, and isn’t available to services or programs running outside a specific user session. So… I might change the batch program to look at \serverfolder_1folder_2 instead of X:

Discuss This Question: 9  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • PDMeat
    The security context is local only (like signing on to the PC as a local user with no domain credentials). If you did a net use q: domainnameusername and punch in a password, that will work. I'm not familiar with runrmtcmd but if it has an option to connect with domain security credentials, you need to use that. Most other programs like this work the same way. You may want to look at rclient/rconsvc from the MS resource kits. That runs as a service on the target host and when you connect to it I beleive it actually uses your connecting domain credentials by default so you wouldn't have to enter your creds each time.
    0 pointsBadges:
    report
  • Marcola
    You may also do the following as long as the user has access rights to the share. To map the drive do: net use x: computernamesharename To map the drive permanently do: net use x: computernamesharename /persistant To delete the drive mapping do: net use x: /delete Once the drive is mapped you can treat it as any other drive.
    0 pointsBadges:
    report
  • TylerDurden
    Thanks all, especially pcatlin who twigged me to one of the problems. It turns out there are several things going on here. In my "sterile" test environment, using the ip address of the server and the share name instead of the UNC name was what fixed the problem. At my live site, the exact same solution still gives "System error 1312. A specified logon session does not exist. It may already have been terminated". Again, I'm suspecting Windows domain or permission issues and am having a closer look at the rest of the network.
    0 pointsBadges:
    report
  • TylerDurden
    Thanks all, especially pcatlin who twigged me to one of the problems. It turns out there are several things going on here. In my "sterile" test environment, using the ip address of the server and the share name instead of the UNC name was what fixed the problem. At my live site, the exact same solution still gives "System error 1312. A specified logon session does not exist. It may already have been terminated". Again, I'm suspecting Windows domain or permission issues and am having a closer look at the rest of the network.
    0 pointsBadges:
    report
  • Mortree
    Using the IP & share name is still a UNC. Providing the IP just shortcuts name resolution. By any chance did your "Sterile" test environment use the same account name and password on local and remote machines? This is one way to trick security contexts expecially where the two machine are not in the same AD domain or not even in same forest context. Permanent drive mapping isn't really going to work since the CMD environment is temporary and is destroyed when it is exited. The mapping of drives as a first step within the batch files is the way to go -- if using UNCs is too complex or impractical. Plus for permissions you need to figure out what local account is executing your CMD environment on the remote machine. This similar to how if a batch file is invoked as a scheduled task from the account running the task scheduler service. Any CMD environment invoked remotely without local logon service will inherit the drive mapping etc from the SYSTEM account (XP might be different than 2000). There are, as mentioned by previous posts, parameters that can pass along a particular security account context.
    0 pointsBadges:
    report
  • Mortree
    IF NET USE can't find the account to access the share you get that 1312 error. Usually NET USE can't find the account because it can not read your mind about which machine has the account you named. When using NET USE you need to specify the machine on which the account for accessing the share exists using backslash notation. Assume the remote machine is called RemoteMachine and the account you wish to run CMD batch fiels under on RemoteMachine is called AccountCMD. (all on one line) NET USE X: RemoteMachineShare /user:RemoteMachineAccountCMD Password Again what probably happened in your sterile environment is that both your local and remote machine had accounts with the same name and same password. Thus your NET USE command actually caused initial password checking against the local no the remote account. But this worked out because the token created for accessing the share ends up matching the same account and password on the remote machine. So your production/real world problems probably come about because your aren't using matching accounts and passwords on the local machine and remote machines.
    0 pointsBadges:
    report
  • TomLiotta
    Consider that you can send compound commands. Multiple commands might be sent in a single transaction; compound commands can be separated with ampersand ("&") or other reserved characters. One useful command to send first is CWBLOGON. Issue a logon back to the server right in the remote command session. Enter CWBLOGON at a Windows command line with no parameters for help info. Tom
    125,585 pointsBadges:
    report
  • Rajgoaj
    Try using STRPCCMD, STRPCO need to be started for using this command.
    280 pointsBadges:
    report
  • TomLiotta
    Try using STRPCCMD, STRPCO need to be started for using this command. STRPCCMD is useful inside of an interactive session when the emulator supports it, but is no help with batch processes that need to run commands on PCs (or other systems on the network) nor through some emulators. It has a 123-character limit for the command string RUNRMTCMD works batch or interactive regardless of emulator. But it also requires knowing the IP address or host name of the target system and needs a user available on the target. Some rexecd() service also must be started on the target. It has a 2000-character command string limit. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following