Shadowing: ambush your users!

S

Scott Marquardt

Ever had a voice mail or page from a user, asking for you to remote control
them to help with something or other, and when you went to shadow them they
had left their machine, leaving you hanging (if you're set up to require
permission to shadow)? Users who want you, but not badly enough to hang
around!

Here's a script to help. You enter the user and terminal server they're on.
The script hangs around until they touch their mouse, and then WHAM -- it
ambushes them and immediately prompts them to approve your remote control
session with them. It beeps to let you know, while you're about other
tasks, that they're finally interested in getting the help they so
desperately paged you for as they were leaving for lunch. ;-)

Although this script was made for Citrix, the technique works for RDP
shadowing as well.

I publish this script on Citrix thus:

C:\WINNT\system32\cscript.exe \\path\ambush.vbs

Just run it via the pnagent in the client systray when you want to shadow
someone.

(By the way, I've tried appending " %*" to this path to pass client
parameters, but I'll be dinged if I can get it to work. Anyone care to
share the secret?)

The .vbs script, then, looks like this:

: '==========================================================================
: '
: ' NAME: Monitor and shadow terminal service users (works with ICA and RDP)
: '
: ' AUTHOR: Scott Marquardt
: ' DATE : 11/1/2003
: '
: ' PURPOSE: A recurrent hassle in supporting terminal users is that when
: ' they page you for help, invariably when you shadow them from
: ' the terminal manager MMC, they've stopped looking at their
: ' screens and your request times out. This script examines a
: ' user's idle time, and kicks off a shadow when the user comes
: ' back to a non-idle state.
: '
: ' COMMENT: The script currently works only in a remote session, whether
: ' ICA or RDP. There's almost no error checking. My plan is to
: ' create an hta application that provides for an autorefreshing
: ' enumeration of users on multiple servers, and automatically
: ' shadows from either a session or client script instance.
: '
: '==========================================================================
:
: set sh = createobject("wscript.shell")
: While pigsfly <> true
: user = InputBox("Enter user (blank to quit)")
: If Len(user)<1 Then WScript.Quit
: machine = InputBox("Enter machine (blank to quit)")
: If Len(machine)<1 Then WScript.Quit
: WScript.Echo "Monitoring " & user & " on " & machine
: userstatus user, machine
: wend
:
: Function userstatus(user,machine)
: temp3 = " "
: while trim(temp3) <> "."
: temp1 = GetStdOut("quser /server:" & machine)
: temp2 = InStr(1,temp1,user,vbTextCompare)
: temp3 = Mid(temp1,temp2 + 59,3)
: WScript.Sleep(5000)
: progress = progress & "."
: if len(progress) = 10 then progress = "."
: WScript.Echo machine & ": " & user & " " & temp3 & " " & progress
: wend
: sessionID = trim(Mid(temp1,temp2 + 40,3))
: sh.Run "cmd /c echo " & chr(7), 0
: sh.Run "Shadow " & sessionID & " /server:" & machine
: End function
:
: Function GetStdOut(ByVal sCommand)
: Dim oExec
: Set oExec = sh.Exec(sCommand)
: Do While oExec.Status <> 1 : Wscript.Sleep(10) : Loop
: GetStdOut = oExec.StdOut.ReadAll
: End Function
 
A

Adysthemic

Scott Marquardt said:
Ever had a voice mail or page from a user, asking for you to remote control
them to help with something or other, and when you went to shadow them they
had left their machine, leaving you hanging (if you're set up to require
permission to shadow)? Users who want you, but not badly enough to hang
around!

Here's a script to help. You enter the user and terminal server they're on.
The script hangs around until they touch their mouse, and then WHAM -- it
ambushes them and immediately prompts them to approve your remote control
session with them. It beeps to let you know, while you're about other
tasks, that they're finally interested in getting the help they so
desperately paged you for as they were leaving for lunch. ;-)

Although this script was made for Citrix, the technique works for RDP
shadowing as well.

I publish this script on Citrix thus:

C:\WINNT\system32\cscript.exe \\path\ambush.vbs

Just run it via the pnagent in the client systray when you want to shadow
someone.

(By the way, I've tried appending " %*" to this path to pass client
parameters, but I'll be dinged if I can get it to work. Anyone care to
share the secret?)

The .vbs script, then, looks like this:

: '==========================================================================
: '
: ' NAME: Monitor and shadow terminal service users (works with ICA and RDP)
: '
: ' AUTHOR: Scott Marquardt
: ' DATE : 11/1/2003
: '
: ' PURPOSE: A recurrent hassle in supporting terminal users is that when
: ' they page you for help, invariably when you shadow them from
: ' the terminal manager MMC, they've stopped looking at their
: ' screens and your request times out. This script examines a
: ' user's idle time, and kicks off a shadow when the user comes
: ' back to a non-idle state.
: '
: ' COMMENT: The script currently works only in a remote session, whether
: ' ICA or RDP. There's almost no error checking. My plan is to
: ' create an hta application that provides for an autorefreshing
: ' enumeration of users on multiple servers, and automatically
: ' shadows from either a session or client script instance.
: '
: '==========================================================================
:
: set sh = createobject("wscript.shell")
: While pigsfly <> true
: user = InputBox("Enter user (blank to quit)")
: If Len(user)<1 Then WScript.Quit
: machine = InputBox("Enter machine (blank to quit)")
: If Len(machine)<1 Then WScript.Quit
: WScript.Echo "Monitoring " & user & " on " & machine
: userstatus user, machine
: wend
:
: Function userstatus(user,machine)
: temp3 = " "
: while trim(temp3) <> "."
: temp1 = GetStdOut("quser /server:" & machine)
: temp2 = InStr(1,temp1,user,vbTextCompare)
: temp3 = Mid(temp1,temp2 + 59,3)
: WScript.Sleep(5000)
: progress = progress & "."
: if len(progress) = 10 then progress = "."
: WScript.Echo machine & ": " & user & " " & temp3 & " " & progress
: wend
: sessionID = trim(Mid(temp1,temp2 + 40,3))
: sh.Run "cmd /c echo " & chr(7), 0
: sh.Run "Shadow " & sessionID & " /server:" & machine
: End function
:
: Function GetStdOut(ByVal sCommand)
: Dim oExec
: Set oExec = sh.Exec(sCommand)
: Do While oExec.Status <> 1 : Wscript.Sleep(10) : Loop
: GetStdOut = oExec.StdOut.ReadAll
: End Function
This looks cool,I can't wait to try it.After Thanksgiving I'll set it
up,what fun ,hehhe,how many times has someone that has needed "desperate"
help,only to put you on hold for "just a sec" ,Adysthemic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top