VBScript to shutdown computer if idle and email an alert

We currently deploy a gpo that runs off of task scheduler to shutdown the computer each night if left on at 1am if idle using shutdown.exe.. What I want to add is to email the IT department informing us that the person left the PC on... How can I accomplish this?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Add a new action (Send an e-mail) to the same Task that shuts down the computer.
MorrisonCohenAuthor Commented:
I don't see the ability to add a new action?
Which client are you testing on: XP or 7 (or even something else)?
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

MorrisonCohenAuthor Commented:
Click New...
Select "Send an e-mail"...
MorrisonCohenAuthor Commented:
I am using Group policy to set it up not task scheduler..  How can I do it via gpo?
It would help us a lot if you could be more specific.
How are you actually using GPO to shut down the remote PC? What you posted on your initial post isn't enough to understand your actual scenario.
GPOs can be used to deploy tasks - I think this is what you are doing. What you might be missing, is to chose the right type of task. Tasks from the level of win xp don't support multiple actions, so please deploy a task of the level vista or higher. You would need a DC with 2008 R2 or 2012 to do that, or, if your DC is 2008 or lower, you would need RSAT started on win7/win8 to setup the task.
Kyle DaviesRetail Software SpecialistCommented:
Here is a link to software that can actually shutdown the PC's i am sure it will also do what you want it to do.

Here's a vbscript to send a mail. Just change the "from" and "to" address, and the e-mail server :

With CreateObject("CDO.Message")
.From="from address"
.To="to adress"
.Subject="Mail subject"
.TextBody="Hello," & Chr(13) & "This is a test mail" & Chr(13) & "Have a nice day"

.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "MAILSERVER"
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
On Error Resume Next
If Err.Number <>0 Then
MsgBox Err.Description,16,"Error"
End If
'msgbox "mail sent"
On Error GoTo 0
End With

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.