Windows Error: Microsoft VBScript runtime error ‘800a0046’ Permission denied

When you are using CDONTS to sending email with ASP script and you getting the following error,

Microsoft VBScript runtime error '800a0046'
Permission denied
/filename.asp, line xx

 where xx is the line number using the send method of the NewMail object.

To resolve this issue, you may check the folder permission  of your pickup folder in your mail root directory.

1. Access to the mailroot directory and normally it is installed in C:\inetpub\mailroot.
2. Right click on the Pickup folder and select properties.
3. Check if IUSR_<computer> and IWAM_<computer> are added. Else, add it.

WScript: Get Email when disk space low

Yesterday, Mick Genie come out a script to generate the free space from your computer, and it might useful for you for certain purpose.

However, I have think off if this is very inconvenience if you need to login to the computer for every time.

Hence I have come out another script to use IIS SMTP server to send an email to you when the disk space is low.

Set objMessage = CreateObject(“CDO.Message”)
objMessage.Subject = “Disk Space Alert: ServerName”
objMessage.From = “Disk Space Alert<Disk Space Alert>”
objMessage.To = “[email protected]

Dim objShell, space_value, Result
Set objShell = Wscript.CreateObject(“WScript.Shell”)

Set DiskSet = GetObject(“winmgmts:{impersonationLevel=impersonate}”).ExecQuery (“select * from Win32_LogicalDisk where DriveType=3″)
For each Disk in DiskSet
If (Disk.Name=”D:”) Then
Result = Disk.FreeSpace
End If
space_value = Result
Wscript.echo space_value
if space_value < 30 then

objMessage.TextBody = “Server Disk Space Low, ” & space_value & ” GB”
objMessage.Configuration.Fields.Item (“”) = 2
objMessage.Configuration.Fields.Item (“”) = “”
objMessage.Configuration.Fields.Item (“”) = 25

end if

You need to change the Subject, From, To, Email IP, and port only.

Note: This script tested only work with 32bits box, but not 64 bits box.  Save this file to anyname.vbs will do.

VBScript FormatNumber Function

Sometimes, you might want to use FormatNumber function from VBScript to update you number/string.

The syntax of the FormatNumber could be find as below.

FormatNumber(Expression[,NumDigAfterDec[, IncLeadingDig[,UseParForNegNum[,GroupDig]]]])

Sample as below,


Result: 10,000.00

Continue reading VBScript FormatNumber Function