Re: help emailing this script
- From: arthursc <arthursc@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 16 Jun 2008 06:41:01 -0700
Thanks pegasus,
Where do I add this in my script?
"Pegasus (MVP)" wrote:
You could use this code to generate an EMail note and.
optionally add an attachment:
schema = "http://schemas.microsoft.com/cdo/configuration/"
Set objEmail = CreateObject("CDO.Message")
With objEmail
.From = "arthur@xxxxxxxxxx"
.To = "andrew@xxxxxxxxxx"
.Subject = "Test Mail"
.Textbody = "The quick brown fox " & Chr(10) & "jumps over the lazy dog"
.AddAttachment "d:\Testfile.txt"
With .Configuration.Fields
.Item (schema & "sendusing") = 2
.Item (schema & "smtpserver") = "mail.arthur.com"
.Item (schema & "smtpserverport") = 25
.Item (schema & "smtpauthenticate") = cdoBasic
.Item (schema & "sendusername") = "arthur@xxxxxxxxxx"
.Item (schema & "sendpassword") = "somepassword"
End With
.Configuration.Fields.Update
.Send
End With
"arthursc" <arthursc@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FEECF420-1D45-47FA-8473-D91BBE933C9B@xxxxxxxxxxxxxxxx
Thanks...But,
How do I add this to my script below and attatch the output?
"ThatsIT.net.au" wrote:
Here is an example I made for someone else,
http://dev.thatsit.net.au/samples/wsh/thatsit/messaging/sendemailwithdelveryreceipt.aspx
remove this line if you don't want a read receipt
.DSNOptions = CDO_SUCCESS_FAIL_DELAY
"arthursc" <arthursc@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D4D0A5F8-766F-4CF1-AE68-421D838E4245@xxxxxxxxxxxxxxxx
Hi
I have the following script that I want to email the output in html to
some
users.
I am not a vbscripting guy, so would not know where to start.
Your help is appreciated.
Option Explicit
const strComputer = "."
const strReport = "c:\diskspace.txt"
Dim objWMIService, objItem, colItems
Dim strDriveType, strDiskSize, txt
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk
WHERE DriveType=3")
txt = "Drive" & vbtab & "Size" & vbtab & "Used" & vbtab & "Free" &
vbtab &
"Free(%)" & vbcrlf
For Each objItem in colItems
DIM pctFreeSpace,strFreeSpace,strusedSpace
pctFreeSpace = INT((objItem.FreeSpace / objItem.Size) * 1000)/10
strDiskSize = Int(objItem.Size /1073741824) & "Gb"
strFreeSpace = Int(objItem.FreeSpace /1073741824) & "Gb"
strUsedSpace = Int((objItem.Size-objItem.FreeSpace)/1073741824) & "Gb"
txt = txt & objItem.Name & vbtab & strDiskSize & vbtab & strUsedSpace &
vbTab & strFreeSpace & vbtab & pctFreeSpace & vbcrlf
Next
writeTextFile txt, strReport
wscript.echo "Report written to " & strReport & vbcrlf & vbcrlf & txt
' Procedure to write output to a text file
private sub writeTextFile(byval txt,byval strTextFilePath)
Dim objFSO,objTextFile
set objFSO = createobject("Scripting.FileSystemObject")
set objTextFile = objFSO.CreateTextFile(strTextFilePath)
objTextFile.Write(txt)
objTextFile.Close
SET objTextFile = nothing
end sub
- Follow-Ups:
- Re: help emailing this script
- From: Pegasus \(MVP\)
- Re: help emailing this script
- References:
- help emailing this script
- From: arthursc
- Re: help emailing this script
- From: ThatsIT.net.au
- Re: help emailing this script
- From: arthursc
- Re: help emailing this script
- From: Pegasus \(MVP\)
- help emailing this script
- Prev by Date: Re: Alert codes
- Next by Date: Re: help emailing this script
- Previous by thread: Re: help emailing this script
- Next by thread: Re: help emailing this script
- Index(es):
Relevant Pages
|