Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
nmulder
Engaged Sweeper
I am not sure if anyone can help with this or not. I am looking to write a vb script that will pull the computer name I run it on and will take username and password from me and use those to run a command. I am using psexec and want to have a custom action that launches a remote cmd window for the machine I run it on. If there is a better way to do this I am open to hearing that as well. I currently have the script pulling the name right if I echo it, but it is not letting me insert that into a cmd command .

Any help would be great. Thanks in advance.
Nick
5 REPLIES 5
Salamine
Engaged Sweeper III
If WScript.Arguments.Count = 1 Then
strcomputer= WScript.Arguments(0)

Dim wshShell
Set wshShell = WScript.CreateObject("WScript.Shell")

wshShell.Run "\\<lansweeperserver>\actions\pstools\psexec.exe " & strcomputer & "<command>"

Set wshShell = Nothing
WScript.Quit
EB
Engaged Sweeper III
for use outside lansweeper you could use this in a batch file...or trigger the batch inside lansweeper...idk...havent tried that ...

BATCHFILE CONTENT:::


@echo off
:rerun
echo Enter Machine Name OR IP Address
set /p machine=
psexec \\%machine% cmd

echo Do you want to run it again? y or n
set /p ans=
@ECHO OFF
IF %ans%==y GOTO rerun
IF %ans%==n GOTO No

:No
GOTO End
:end


EB
Engaged Sweeper III
I am not sure why yours asks for cred's....mine just runs and works...

{actionpath}psexec \\{computer} cmd


this should work under current user...
nmulder
Engaged Sweeper
No one has any idea?
nmulder
Engaged Sweeper
I found that it is easier to pass this command "{actionpath}pstools\PsExec.exe \\{computer} -u domain\username -p password cmd" Is there a way to insert credentials of currently logged in lasweeper user? or prompt for credential input? I would rather not have credentials hard coded in the command itself.

Archive

This board contains archived posts from the retired Lansweeper Forum and Insiders Community.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now