topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday November 8, 2024, 7:29 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Send an email when remote computer is not in use  (Read 10139 times)

screenshots

  • Participant
  • Joined in 2013
  • *
  • default avatar
  • Posts: 5
    • View Profile
    • Donate to Member
Send an email when remote computer is not in use
« on: April 23, 2014, 02:04 PM »
I do remote IT work for various clients. I always have to call ahead to be sure I am not interrupting anyone's work before logging into their PC. I would find it really useful to be able to have a small program running on the remote computer, that would email me when the client has been away from their computer for a certain amount of time. My particular client has an irregular schedule and I have to jump in and do remote work whenever I get the chance. I can't be calling him up all day to find out if he's using his computer, hence my desire for an email notification.

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Send an email when remote computer is not in use
« Reply #1 on: April 23, 2014, 08:09 PM »
This utility would do it, although it's pretty primitive. You'd also need to put a copy of blat.exe on the box and set up a batch file to send the email.  If you don't want it to show as a running program, you'd need srvany (or, better, nssm, the non-sucky service manager) to run it as a service.

vi vi vi - editor of the beast

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Send an email when remote computer is not in use
« Reply #2 on: April 23, 2014, 08:20 PM »
You might also consider an alternative to sending an email -- perhaps a tool that simply updated a web page somewhere with some metrics.  That would be less troublesome than sending emails in my opinion.

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Send an email when remote computer is not in use
« Reply #3 on: April 24, 2014, 05:26 AM »
True, although the real issue is how do you detect idle time. Can't go by CPU alone, other stuff can get kicked off in "idle time" that uses cpu. Screen saver might be disabled. Probably mouse & keyboard input would be best to check.

On the other hand, you would really also want to be notified when the idle time ends, or you're liable to connect up when the person is back from his snack break.
vi vi vi - editor of the beast

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,649
    • View Profile
    • Donate to Member
Re: Send an email when remote computer is not in use
« Reply #4 on: April 24, 2014, 07:04 AM »
You might also consider an alternative to sending an email -- perhaps a tool that simply updated a web page somewhere with some metrics.  That would be less troublesome than sending emails in my opinion.

That was my first thought when reading this as well.

On the other hand, you would really also want to be notified when the idle time ends, or you're liable to connect up when the person is back from his snack break.

Bingo! This is really trying to solve a people problem with technology me thinks.

One thing that would help is if we knew what technology is being used for the connection RPD, or VNC. With VNC you can see the user's movements and the user can see their wallpaper change/disappear (assuming they're paying attention). RDP is an all or none which will pull the session away from the user...but they have the option of just taking it back as well.

Mitigating options are first and foremost explaining the situation to the user so they know what to look for when support logs in ... and how to signal them that now's a bad time. If the user agrees to log off when not using/needing the machine, and you use a separate support acct to log in with RDP then the system will flag you that someone else is currently logged in eliminating the guess work. I share access to a machine with several other vendors at a client using this method.

If you are using RDP and the users accounts to access the machines, then just have them take the session back and text/email you at that point with give me 20min or an hour to do X. This has worked well for me while managing several hundred machines for quite a few years now. And annoying as it may seem...people seem to appreciate the human touch afforded by a direct interaction to the hit or miss nature of assumptions required by automation.

techidave

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,044
    • View Profile
    • Donate to Member
Re: Send an email when remote computer is not in use
« Reply #5 on: April 25, 2014, 06:07 AM »
why not use the chat feature to ask them if now is ok that is built into VNC after you have remoted in? 

BigVent

  • Member
  • Joined in 2013
  • **
  • Posts: 36
    • View Profile
    • Donate to Member
Re: Send an email when remote computer is not in use
« Reply #6 on: May 08, 2014, 03:17 PM »
Here's a very quick example of what you needed.

Notes:
  • Timer is set to fire after 45 minutes of idle time (adjust as needed)
  • Should the program then exit after it fires? (I'm not sure how often you needed notices so I'll leave that up to you)
  • Easy email send via COM - adjust your email & credentials


Enjoy!

Code: Autohotkey [Select]
  1.  
  2. time := 2700000 ;//45 minutes
  3.  
  4. SetTimer, check, 300000 ;//check once every 5 min
  5. return
  6.  
  7. check:
  8.         if(A_TimeIdle >= time)
  9.         {
  10.                 email()
  11.                 SetTimer, check, off
  12.         }
  13. return
  14.  
  15. ;//function email
  16. email()
  17. {
  18.         pmsg                    := ComObjCreate("CDO.Message")
  19.         pmsg.From               := "[email protected]"
  20.         pmsg.To                 := "[email protected]"
  21.         pmsg.BCC                := ""   ; Blind Carbon Copy, Invisable for all, same syntax as CC
  22.         pmsg.CC                 := ""
  23.         pmsg.Subject    := "PC in question is idle"
  24.  
  25.         ;You can use either Text or HTML body like
  26.         pmsg.TextBody   := A_Username " 's PC is idle."
  27.         ;OR
  28.         ;pmsg.HtmlBody := "<html><head><title>Hello</title></head><body><h2>Hello</h2><p>Testing!</p></body></html>"
  29.  
  30.         ;var := A_ScriptDir
  31.         ;msgbox % var
  32.         ;"%SPVvar%"|"%VPNvar%"
  33.         ;SPVvar := A_ScriptDir "\blah.txt"
  34.         ;VPNvar := A_ScriptDir "\blah1.txt"
  35.  
  36.         sAttach                 = ;%SPVvar%|%VPNvar%
  37.  
  38.  
  39.                 ; can add multiple attachments, the delimiter is |
  40.  
  41.         fields := Object()
  42.         fields.smtpserver   := "smtp.gmail.com" ; specify your SMTP server
  43.         fields.smtpserverport     := 465 ; 25
  44.         fields.smtpusessl      := True ; False
  45.         fields.sendusing     := 2   ; cdoSendUsingPort
  46.         fields.smtpauthenticate     := 1   ; cdoBasic
  47.         fields.sendusername := "[email protected]"
  48.         fields.sendpassword := "password12345"
  49.         fields.smtpconnectiontimeout := 60
  50.         schema := "http://schemas.microsoft.com/cdo/configuration/"
  51.  
  52.         pfld :=   pmsg.Configuration.Fields
  53.  
  54.         For field,value in fields
  55.                 pfld.Item(schema . field) := value
  56.         pfld.Update()
  57.  
  58.         Loop, Parse, sAttach, |, %A_Space%%A_Tab%
  59.           pmsg.AddAttachment(A_LoopField)
  60.          
  61.         pmsg.Send()
  62.         return
  63. }
  64.  
  65. esc::
  66.         critical
  67.         exitapp
  68. return
~BigVent