Jump to content

Hey guys,

 

I'm stuggling to make a batch file that uses RCMD to start another Batch file on a network PC.

 

Please review and let me know your thoughts. I've had to *** out folders to conceal my employer (sorry!)

 

@echo off
echo This file must be placed on your Jumpbox desktop.
set /p ID="Enter ID:"
C:\*****\pstools\rcmd \\%ID%-bos1 cmd

start "" "c:\Program Files (x86)\*****\SiteLink\Bin\MsgManCallHostNow.bat"
pause

 

Thanks in advance.

 

Brad

Link to comment
https://linustechtips.com/topic/710289-help-please/
Share on other sites

Link to post
Share on other sites

15 hours ago, icey said:

C:\*****\pstools\rcmd \\%ID%-bos1 cmd

Shouldn't this be "cmd.exe" in the end? (not sure if it makes a difference).

15 hours ago, icey said:

start "" "c:\Program Files (x86)\*****\SiteLink\Bin\MsgManCallHostNow.bat"

Why are you using "start"? If you want to run a batch file just traverse to it as follows:

 

c:\Program Files (x86)\*****\SiteLink\Bin\MsgManCallHostNow.bat

 

and it will run. Only use "start" if you want to run stuff asynchronously. Is that what you're trying to do?

Link to comment
https://linustechtips.com/topic/710289-help-please/#findComment-9071113
Share on other sites

Link to post
Share on other sites

1 hour ago, Darkangel86 said:

Shouldn't this be "cmd.exe" in the end? (not sure if it makes a difference).

Why are you using "start"? If you want to run a batch file just traverse to it as follows:

 

c:\Program Files (x86)\*****\SiteLink\Bin\MsgManCallHostNow.bat

 

and it will run. Only use "start" if you want to run stuff asynchronously. Is that what you're trying to do?

Thanks Darkangel,

 

It doesn't matter whether you specify cmd's file extension.

 

I've removed start and it makes no difference. 

 

When I run the batch file, it connects to the remote machine via RCMD and then does nothing.

Link to comment
https://linustechtips.com/topic/710289-help-please/#findComment-9071725
Share on other sites

Link to post
Share on other sites

1 minute ago, icey said:

Thanks Darkangel,

 

It doesn't matter whether you specify cmd's file extension.

 

I've removed start and it makes no difference. 

 

When I run the batch file, it connects to the remote machine via RCMD and then does nothing.

How are you sure that it is doing nothing vs. just not returning an output to you?

 

In the batch file, can you have it create a file or dump output to file just to verify whether or not something's happening on the remote machine?

Link to comment
https://linustechtips.com/topic/710289-help-please/#findComment-9071738
Share on other sites

Link to post
Share on other sites

4 minutes ago, Darkangel86 said:

How are you sure that it is doing nothing vs. just not returning an output to you?

 

In the batch file, can you have it create a file or dump output to file just to verify whether or not something's happening on the remote machine?

I have no idea, I do like the sound of it though :D

Link to comment
https://linustechtips.com/topic/710289-help-please/#findComment-9071753
Share on other sites

Link to post
Share on other sites

5 minutes ago, icey said:

It's definitely not executing the batch file I can confirm

 

Okay, let's backtrack a little bit.

 

Can you do any thing on the remote machine?

 

Let's try to do something like "dir > output.txt" in C:\

 

then verify that output.txt was created in C:\ (you need to be admin to do this).

Link to comment
https://linustechtips.com/topic/710289-help-please/#findComment-9071855
Share on other sites

Link to post
Share on other sites

1 minute ago, Darkangel86 said:

Okay, let's backtrack a little bit.

 

Can you do any thing on the remote machine?

 

Let's try to do something like "dir > output.txt" in C:\

 

then verify that output.txt was created in C:\ (you need to be admin to do this).

Yes I have full privs - I'm able to do anything in the cmd prompt once the batch file connects to the remote machine

Link to comment
https://linustechtips.com/topic/710289-help-please/#findComment-9071863
Share on other sites

Link to post
Share on other sites

1 minute ago, icey said:

Yes I have full privs - I'm able to do anything in the cmd prompt once the batch file connects to the remote machine

Okay, can you run OTHER batch files? Create a simple one and test.

 

Also can you actually execute the following line manually once you are connected to the remote machine?

18 hours ago, icey said:

start "" "c:\Program Files (x86)\*****\SiteLink\Bin\MsgManCallHostNow.bat"

If so, what is the output?

Link to comment
https://linustechtips.com/topic/710289-help-please/#findComment-9071875
Share on other sites

Link to post
Share on other sites

28 minutes ago, Darkangel86 said:

Okay, can you run OTHER batch files? Create a simple one and test.

 

Also can you actually execute the following line manually once you are connected to the remote machine?

If so, what is the output?

It works as intended if I paste " c:\Program Files (x86)\*****\SiteLink\Bin\MsgManCallHostNow.bat"  after the cmd prompt opens

 

I can also run any batch file, no a question of privs being network admin

Link to comment
https://linustechtips.com/topic/710289-help-please/#findComment-9072022
Share on other sites

Link to post
Share on other sites

Thanks for all your help Darkangel,

 

I figured out the batch file I was trying to run was simply calling another batch file. I re-wrote it to look like this which works perfectly :)

 

@echo off
echo This file must be placed on your Jumpbox desktop.
set /p ID="Enter Site ID: "
C:\*****\pstools\rcmd \\%ID%-bos1 call "c:\Program Files (x86)\*******\SiteLink\Bin\SSMsgManCtrl.exe" CONTACTHOST
sleep 3
echo Download Complete!
pause

 

Link to comment
https://linustechtips.com/topic/710289-help-please/#findComment-9098064
Share on other sites

Link to post
Share on other sites

3 hours ago, icey said:

Thanks for all your help Darkangel,

 

I figured out the batch file I was trying to run was simply calling another batch file. I re-wrote it to look like this which works perfectly :)

 

@echo off
echo This file must be placed on your Jumpbox desktop.
set /p ID="Enter Site ID: "
C:\*****\pstools\rcmd \\%ID%-bos1 call "c:\Program Files (x86)\*******\SiteLink\Bin\SSMsgManCtrl.exe" CONTACTHOST
sleep 3
echo Download Complete!
pause

 

Glad it worked out! Thanks for reporting back so others can utilize your findings!

Link to comment
https://linustechtips.com/topic/710289-help-please/#findComment-9098992
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×