vbscript virker ikke på net
hej.jeg har lavet et script som fint virker på xp men på windows nt kommer den med en fejl
Error: 800a01ad - ActiveX Component can't create object: 'CDO.message
jeg har sikret mig at cdonts.dll er registreret på nt men den vil bare ikke
nogen der har et godt råd til hvad der kan være galt.
her er koden
Function GetCurrentComputerName
set oWsh = WScript.CreateObject("WScript.Shell")
set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
End Function
'====================================================================================
' Begin main code
'====================================================================================
str = ""
set oFs = WScript.CreateObject("Scripting.FileSystemObject")
set oDrives = oFs.Drives
strComputerName = GetCurrentComputerName ' get name only once for performance reasons
for each oDrive in oDrives
if (oDrive <> "A:") then
str = str & strComputerName & "," & oDrive.DriveLetter & "," & oDrive.TotalSize & "," & oDrive.FreeSpace & vbcrlf
end if
next
msgbox(str)
sendmail "x@x.dk", "x@x.dk", "Server: NUPO Kritisk lav diskplads på Webs-drev", str, "format", "importance", "attachments"
function sendmail(recipients, from, subject, body, format, importance, attachments)
dim objMessage
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = subject
objMessage.From = from
objMessage.To = recipients
objMessage.TextBody = body
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "snowdrop"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update()
objMessage.Send()
set objMessage = nothing
end function