We have recently moved our website from WIn 2008 Server to a 64-bit Win 2012 server running IIS 8. We have an auto billing script that runs each night. This is a simple VBS file that is run through the task scheduler. However, on the new server this script errors out on trying to instantiate the Persits.Mailsender object but ONLY when running directly on the server (either from the task scheduler or directly from the CMD line as Administrator). But it works fine when instantiated through a web based ASP scipt (running obviously as IUSR).
I know the DLL is installed and registered correctly (because I can send email through web-based scripts). but not locally.
Here's a simple test script I wrote to test it:
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.From = "email@example.com"
Mail.Host = "mx1.mydomain.com"
Mail.Subject = "Test"
strBody = "What's up?"
Mail.Body = strBody
The above code, when run from the web (as an ASP file) works perfectly, however when run at the cmd line (as an admin, and with just CreateObject or WScript.CreateObject rather than Server.CreateObject) gives this:
Microsoft VBScript runtime error: ActiveX component can't create object: 'Persits.MailSender'
What the heck??
P.S. I have already changed the local script to use CDO instead, but I still want to know the answer to why this is behaving in this manner - and I'm willing to spend the points to ease my mind and hopefully help someone else in the future.