/build/static/layout/Breadcrumb_cap_w.png

KACE Product Support Question


Is it possible to use KACE Device Actions to run .bat with prompts? K1000

07/01/2020 131 views

I have a .bat file that streamlines using RPD mstsc with -shadow flag.  The shadow flag requires that the administrator knows the session id that they are trying to shadow.

The .bat file accepts a command line parameter for computer name that I would like to replace with KACE_HOST_NAME.   Then it prompts the admin for a user name and runs query  session against the host for that user.  The last prompt in the bat file is for the administrator to input the session ID they need to connect to.  Then the .bat combines it all into mstsc /v:%computer% /shadow:%session% /control  

The .bat file works great on its own but I would love to figure out how to add this as a KACE Device Action.

I tried: cmd.exe "{path to .bat} KACE_HOST_NAME"  but the command window just speeds through all lines without prompting.

I also tried it with cmd.exe /k   and cmd.exe /c  but again it just ignores the prompts.

This is the contents of the functioning .bat

======================================
ECHO off
ECHO Find User Session ID

IF NOT "%1"=="" SET computer="%2"
IF NOT "%2"=="" SET user="%1"

IF "%1"=="" SET /p computer=What Computer ID?
IF "%2"=="" SET /p user=What username?

query session %user% /server:%computer%

SET /p session=What session ID?

mstsc /v:%computer% /shadow:%session% /control

SET "computer="
SET "user="
SET "session="

pause

==========================================

0 Comments   [ + ] Show comments

Comments


Be the first to answer this question

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ