Jump to content

Remote Dos window


mrrlg
 Share

Recommended Posts

I am attempting to script a solution to the following problem. I need to be able to log onto remote servers and open a dos prompt on that remote server for the purpose of running an exacutable. I was able to write the script up to the point of opening the dos window on the remote machine. I would like to script it so it would select the name of the server entered eariler in the script (by using an input box) so I can use one script for many machines.

When I use:

Run(@SystemDir & '\cmd')

it opens the dos window on my machine, not the dos window on the remote machine. How can I edit this command to accomplish this? Is there a way to insert the contents of an InPutBox into this command?

Link to comment
Share on other sites

  • Developers

I am attempting to script a solution to the following problem. I need to be able to log onto remote servers and open a dos prompt on that remote server for the purpose of running an exacutable. I was able to write the script  up to the point of opening the dos window on the remote machine. I would like to script it so it would select the name of the server entered eariler in the script (by using an input box) so I can use one script for many machines.

When I use:

Run(@SystemDir & '\cmd')

it opens the dos window on my machine, not the dos window on the remote machine. How can I edit this command to accomplish this? Is there a way to insert the contents of an InPutBox into this command?

<{POST_SNAPBACK}>

To run a command on a remote machine, you might want to look at PSEXEC from sysinternals.....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Here u are.

usage: psexec [\\computer[,computer[,..] | @file ][-u user [-p psswd]][-n s][-s|-e][-i][-c [-f|-v]][-d][-w directory][-<priority>][-a n,n,...] cmd [arguments]

computer

Direct PsExec to run the application on the computer or computers specified. If you omit the computer name PsExec runs the application on the local system and if you enter a computer name of "\\*" PsExec runs the applications on all computers in the current domain.

@file

Directs PsExec to run the command on each computer listed in the text file specified.

-a

Separate processors on which the application can run with commas where 1 is the lowest numbered CPU. For example, to run the application on CPU 2 and CPU 4, enter: "-a 2,4"

-c

Copy the specified program to the remote system for execution. If you omit this option then the application must be in the system's path on the remote system.

-d

Don't wait for application to terminate. Only use this option for non-interactive applications.

-e

Loads the specified account's profile.

-f

Copy the specified program to the remote system even if the file already exists on the remote system.

-i

Run the program so that it interacts with the desktop on the remote system.

-n

Specifies timeout in seconds connecting to remote computers.

-p

Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password.

-s

Run remote process in the System account .

-u

Specifies optional user name for login to remote computer.

-v

Copy the specified file only if it has a higher version number or is newer on than the one on the remote system.

-w

Set the working directory of the process (relative to the remote computer).

-priority

Specifies -low, -belownormal, -abovenormal, -high or -realtime to run the process at a different priority.

program

Name of the program to execute.

arguments

Arguments to pass (note that file paths must be absolute paths on the target system)

You can enclose applications that have spaces in their name with quotation marks e.g. "psexec \\marklap "c:\long name\app.exe". Input is only passed to the remote system when you press the enter key, and typing Ctrl-C terminates the remote process.

If you omit a username the remote process runs in the same account from which you execute PsExec, but because the remote process is impersonating it will not have access to network resources on the remote system. When you specify a username the remote process executes in the account specified, and will have access to any network resources the account has access to. Note that the password is transmitted in clear text to the remote system.

Examples

This article I wrote describes how PsExec works and gives tips on how to use it:

http://www.winnetmag.com/Windows/Issues/Is.../714/Index.html

The following command launches an interactive command prompt on \\marklap:

psexec \\marklap cmd

This command executes IpConfig on the remote system with the /all switch, and displays the resulting output locally:

psexec \\marklap ipconfig /all

This command copies the program test.exe to the remote system and executes it interactively:

psexec \\marklap -c test.exe

Specify the full path to a program that is already installed on a remote system if its not on the system's path:

psexec \\marklap c:\bin\test.exe

Run Regedit interactively in the System account to view the contents of the SAM and SECURITY keys::

psexec -i -d regedit.exe

PsTools

PsExec is part of a growing kit of Sysinternals command-line tools that aid in the adminstration of local and remote Windows NT/2K systems named PsTools.

Andre

:lmao:

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
Link to comment
Share on other sites

  • 6 months later...

Here u are.

usage: psexec [\\computer[,computer[,..] | @file ][-u user [-p psswd]][-n s][-s|-e][-i][-c [-f|-v]][-d][-w directory][-<priority>][-a n,n,...] cmd [arguments]

computer

Direct PsExec to run the application on the computer or computers specified. If you omit the computer name PsExec runs the application on the local system and if you enter a computer name of "\\*" PsExec runs the applications on all computers in the current domain.

@file

Directs PsExec to run the command on each computer listed in the text file specified.

-a

Separate processors on which the application can run with commas where 1 is the lowest numbered CPU. For example, to run the application on CPU 2 and CPU 4, enter: "-a 2,4"

-c

Copy the specified program to the remote system for execution. If you omit this option then the application must be in the system's path on the remote system.

-d

Don't wait for application to terminate. Only use this option for non-interactive applications.

-e

Loads the specified account's profile.

-f

Copy the specified program to the remote system even if the file already exists on the remote system.

-i

Run the program so that it interacts with the desktop on the remote system.

-n

Specifies timeout in seconds connecting to remote computers.

-p

Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password.

-s

Run remote process in the System account .

-u

Specifies optional user name for login to remote computer.

-v

Copy the specified file only if it has a higher version number or is newer on than the one on the remote system.

-w

Set the working directory of the process (relative to the remote computer).

-priority

Specifies -low, -belownormal, -abovenormal, -high or -realtime to run the process at a different priority.

program

Name of the program to execute.

arguments

Arguments to pass (note that file paths must be absolute paths on the target system)

You can enclose applications that have spaces in their name with quotation marks e.g. "psexec \\marklap "c:\long name\app.exe". Input is only passed to the remote system when you press the enter key, and typing Ctrl-C terminates the remote process.

If you omit a username the remote process runs in the same account from which you execute PsExec, but because the remote process is impersonating it will not have access to network resources on the remote system. When you specify a username the remote process executes in the account specified, and will have access to any network resources the account has access to. Note that the password is transmitted in clear text to the remote system.

Examples

This article I wrote describes how PsExec works and gives tips on how to use it:

http://www.winnetmag.com/Windows/Issues/Is.../714/Index.html

The following command launches an interactive command prompt on \\marklap:

    psexec \\marklap cmd

This command executes IpConfig on the remote system with the /all switch, and displays the resulting output locally:

    psexec \\marklap ipconfig /all

This command copies the program test.exe to the remote system and executes it interactively:

    psexec \\marklap -c test.exe

Specify the full path to a program that is already installed on a remote system if its not on the system's path:

    psexec \\marklap c:\bin\test.exe

Run Regedit interactively in the System account to view the contents of the SAM and SECURITY keys::

    psexec -i -d regedit.exe

PsTools

PsExec is part of a growing kit of Sysinternals command-line tools that aid in the adminstration of local and remote Windows NT/2K systems named PsTools.

Andre

:whistle:

<{POST_SNAPBACK}>

this is something personal for documentation

to operate with remote pc's which tool is better in PsExec.exe and BeyondExec.exe from www.sysinternals.com and www.beyondlogic.com

thanx for help

Link to comment
Share on other sites

this is something personal for documentation

to operate with remote pc's which tool is better in PsExec.exe and BeyondExec.exe from www.sysinternals.com and www.beyondlogic.com

thanx for help

<{POST_SNAPBACK}>

better is very subjective. i'd say the better one is the one you prefer... look at file sizes, ease of use, and support if you're looking for criteria upon which to judge them... personally i don't use either, but i've used other stuff from sysinternals and i liked the stuff i DID use...
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...