Remote application idea - Quick CMD

Started by Scott M

Scott M

Remote application idea - Quick CMD   02 August 2014, 04:01

Hi,
First of all, thanks for the great program. I'm part of a team that manages about 40 different subnets across the country, and your Network Scanner's built-in bookmarks and WMI query make finding a user on the network and getting the access to fix the problem an absolute breeze. I have multiple instances of it opened throughout the day and use the built in applications menu to call all sorts of tools. This program coupled with Dameware mini remote control has been a paradigm shifting combination as far as I'm concerned. Thank you again.

Ok, enough gushing.

This post started as a feature request, but as I was explaining what I wanted I realized it was already possible. In an effort to salvage something out of the time I wasted writing out this moot request, I figured I'd just share the solution I came up with.

I wanted a way to run a command against a group of computers without first having to define the command in the Applications menu. The line I settled on is at the bottom. It will prompt you for the command you want to run, run it against all of the selected computers, then pause so you can view the results before closing. For instance, I just used this to add a consultant to the local administrators of a group of 15 machines in a blink of an eye.

This will make my life just a little bit easier, hopefully it helps someone else too.

c:\windows\system32\psexec.exe -h \\%0 cmd /c {Command} && pause
SoftPerfect Support forum - Andrew avatar image

Re: Remote Application Idea - Quick CMD   02 August 2014, 18:41

Thank you for sharing your usage idea ok, yes, thumb up

Re: Remote Application Idea - Quick CMD   03 August 2014, 03:28

Scott M, major thanks for sharing.
poulpos8

Re: Remote Application Idea - Quick CMD   05 December 2015, 07:24

Hello,

First of all: Thanks for that awesome tool, I use it daily, and might come ask a few questions related to latest version in a dedicated topic.

Then: sorry for digging an old topic, but this one matches exactly what I'm trying to do, so I used Scott's great submission.
I added those 2 scripts:

C:\Program Files (x86)\Sysinternal Tools\psexec.exe -h \\%0 cmd /c {Command} && pause
C:\Program Files (x86)\Sysinternal Tools\psexec.exe -h -u {username} -p {password} \\%0 cmd /c {Command} && pause

The first one is the exact one you submitted.
The second one lets you define username and password required to log on that specific computer. (I work a lot on networks I don't own, so I have to use my customer's domain admin logon to perform my tasks)

Those two works great, except that they don't pause, so there's no time to review the command line result.

The idea was either to perform basic scripts on lots of computers (add user, map a network drive, etc), or (and this one is specifically more the one I tend to need) regain access to a specific computer (context: I know his credentials, I have an either crashed or shutdowned TeamViewer session on it, and no RDP activated, with my customer gone from his office and no one to manually fix it, and of course that PC is the one who get to host some of our solutions/products where action is needed. PsExec is here needed to activate RDP, regain access to it, and fix that TeamViewer problem in order to proceed to my initial work. This is a ... let's say weekly problem. If I could right click my way through netscan, here-you-are, now I'm in. That would just be smoother.)

What am I missing here in order to have that PsExec effectively paused after that command?

Thanks smile
SoftPerfect Support forum - Andrew avatar image

Re: Remote Application Idea - Quick CMD   05 December 2015, 10:13

I would suggest to replace cmd /c with cmd /k and remove pause, i.e.

psexec.exe -h \\%0 cmd /k {Command}
psexec.exe -h -u {username} -p {password} \\%0 cmd /k {Command}

This should prevent cmd.exe from terminating, so you can see its output.

Re: Remote Application Idea - Quick CMD   05 December 2015, 15:35

To add to this thread.

Using CMD in some case with the /k and others /c with the & pause. For some reason the /k will not stay open under some conditions I don't know why. -WS
poulpos8

Re: Remote Application Idea - Quick CMD   11 December 2015, 04:02

Thx Andrew, this works great !

In reply to WindowStar : it seems to me that any Ctrl+C (let's say I want to end a ping -t) would end the prompted command and the PsExec session in the same time.
I also observed that failed commands or command that had an unexpected result would not only fail but also terminate the PsExec session.

Another PsExec note : some antivirus just won't let it start on distant host (Sophos for example). And event with all antivirus services + agent down, on some PC I just can't open remote HKLM but can open remote HKU, whereas I can open both on some others. I guess I still have to figure out a lot of things to get things done without failing thinking

Anyway, thank you for the /K tip !

Re: Remote application idea - Quick CMD   14 December 2015, 03:42

Andrew,

Just a minor note about a very minor problem:
When in the applications windows (add/edit/remove), you cannot see the entire command if the command is very very long. I am using some very long commands as I find this part of the application very useful. I have 2 monitors and can expand the column out across both screens to see the entire command but the software truncates it.

Again it's very minor, but figured I would mention it. This does not stop the command from working or make not function correctly, this is just a cosmetic issue.

Thanks -WS
Attachments:
open | download – NetScan609ApplicationGUI2.png (56.3 KB)
SoftPerfect Support forum - Andrew avatar image

Re: Remote application idea - Quick CMD   14 December 2015, 19:22

No worries. It's a Windows List View control limitation, unfortunately there is nothing I can do about this issue.

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 ********  ********    ******   **     **  **     ** 
 **        **     **  **    **   **   **    **   **  
 **        **     **  **          ** **      ** **   
 ******    ********   **           ***        ***    
 **        **         **          ** **      ** **   
 **        **         **    **   **   **    **   **  
 ********  **          ******   **     **  **     ** 

Message: