Link to home
Start Free TrialLog in
Avatar of ZabagaR
ZabagaRFlag for United States of America

asked on

Visual Studio or VB6.0 script

Here’s the background:  In Windows 2012 (in workgroup mode) the only way to shadow a user's RDP session is via command line, which is really annoying.

So I wanted to build a small utility around the command line that would be more user friendly.

I wrote “shadow.bat” that eases the pain a little.  It accepts one parameter.  That parameter is the user who you want to shadow.
i.e. If I log on to a 2012 server and want to see what user BOB is doing, I need to run/type:  shadow BOB

My code for "shadow.bat" is simple:
for /F "tokens=3 skip=1" %%i in ('query user %1') DO (
mstsc.exe /shadow:%%i /noConsentPrompt /control
)

The incoming %1 parameter is the username I want to shadow. It obtains the session number of the user from there (%%I) and runs mstsc.exe with a shadow switch. I'm good to go.

What I really want to do is take away the need to run this .bat manually from command line.

How difficult would it be to have my code inside a compiled .exe where upon running, the program presents you with a dropdown list of logged on users, and you pick who you want to shadow ?

So I’d run “shadow.exe” and it would show a list of users logged on to my server, I'd pick a user to shadow, and it basically takes that username and puts it into the %1 variable in my bat script.

I'm good at .bat, vbscript, VB6.0....but .NET not really. This is a little beyond my area of expertise.  does anybody have code suggestions? maybe something I can copy & paste then compile?
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ZabagaR

ASKER

Thanks I've seen the sample code all over too...but unless somebody actually writes it for me in this case, I'm not going to get anywhere.
Maybe you're better off hiring someone to do it for you then.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ZabagaR

ASKER

Thanks, I appreciate the input.  A co-worker who does much more .net helped me out and I got it pretty quickly.