Monday, 17 December 2012

How to shutdown/logoff/restart/lock your computer Remote via Email

How to Shutdown/Lock your computer via Email




There may be many occasion when you might think to shutdown your PC from a remote location. If same type situation comes to you at any time, don't panic here and there by searching in search engines. Today I am going to tell you a cool and easiest trick to shutdown/lock/logoff/restart your computer just by sending a simple mail. Just read the following steps.

What you need for this ?

You need MS Outlook to do this. Because you need to copy-paste some Visual Basic codes in MS Outlook which I am going to give you. If you don't know what is MS Outlook then click here.

How to do ?
  • Configure your email account in MS Outlook.
  • Then press alt+f11 to open the Visual Basic editor.

    (If the alt+f11 does not work in your case then click on New mail message button to compose a message. Then click on the rounded MS Office button present at the top left. Click on to editor option. A window will open where select the check box Show Developer tab in the ribbon to enable the developer tab. Then in the compose window a tab will come, click on it and then click on Visual Basic to open the editor.)
  • In that editor there will be a button Macro Seurity. Click on it, a window will open. Then click on the radio button No security check for macro.
  • Then open the Project1 present in the left side vertical bar navigator then double click on ThisOutlookSession to view the code. If any thing is previously written there then delete them.
  • Then copy and paste the following code in that visual basic editor.
Private Declare Function LockWorkStation Lib "user32.dll" () As Long
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
 Dim EntryID
 Dim lastItem
 EntryID = Split(EntryIDCollection, ",")
 For i = 0 To UBound(EntryID)
    Set lastItem = Application.Session.GetItemFromID(EntryID(i))
    If (LCase(lastItem.Subject) = "shutdown") Then
        Call Shell("Shutdown /s")
    End If
    If (LCase(lastItem.Subject) = "logoff") Then
        Call Shell("Shutdown /l")
    End If
    If (LCase(lastItem.Subject) = "restart") Then
        Call Shell("Shutdown /r")
    End If
    If (LCase(lastItem.Subject) = "lock") Then
        a = LockWorkStation()
    End If
 Next
End Sub
  • Now save the VB Editor and close it and you are done.
How to send Email ?
Now you can shutdown/restart/logoff/lock your computer from a remote location by sending a mail. Just send a mail to the email address which you have configured in Outlook. You need to mention either shutdown/logoff/restart/lock in the subject field to do different tasks respectively. The same has been written below.
  •  Write "shutdown" without the quotes in the subject field to shutdown your computer.
  •  Write "logoff" without the quotes in the subject field to logoff your computer.
  •  Write "restart" without the quotes in the subject field to restart your computer.
  •  Write "lock" without the quotes in the subject field to lock your computer.
Example: Suppose the email which you have configured in Outlook is exampl@gmail.com. Then to shutdown your computer from a remote location, just send a mail from any other email ID as following.

TO:example@gmail.com
Subject:shutdown
Body:You can write anything in the body.

About the Author

Unknown

Author & Editor

He is a Tech Blogger from last 3 years. He loved to learn new things and technologies. He Interested in making Tech Tutorial’s and Graphic Designing.

Post a Comment

Note: only a member of this blog may post a comment.

 
Computer World With IT © 2015 - Designed by Templateism.com