Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Conversion to 64 bit server

Reply
 
Old 07-10-2009   #1 (permalink)
Bernie


 
 

Conversion to 64 bit server

I have a server that just upgraded from 32 bit to 64 bit SBS. Now all their
database report scripts are broken. The ODBC connection is 32bit. When run
from a 32bit command prompt, the database access works fine. The problem is
I can't get the email connection to work. The scripts use CDO to send the
email results of the reports.

The email code works in a 64bit command prompt. But I can't get it to work
in a 32 bit command prompt.

At line;
objEmail = CreateObject("CDO.Message")

I get an error of
Error: "Library not registered."
Code: 8002801D
Source: (null)

This is the same vbs file run under 64bit and 32bit mode.

Any suggestions?

Thanks,
Bernie



My System SpecsSystem Spec
Old 07-10-2009   #2 (permalink)
mayayana


 
 

Re: Conversion to 64 bit server


There are two typical problems whem registering
on Vista/7. One is permissions. The other is that
there are sort of two Registries.

I haven't used 64-bit Windows. (I'm still wondering
why anyone would use it, except maybe some game
developers. I'm not clear about exactly how the COM
registration issues work. But that might be something
worth checking. Maybe CDO is only registered as 64-bit
and the 32-bit process fails looking up the ProgID.

I find some similar problems to what you're describing
by searching Google with:
Wow6432Node "HKEY_CLASSES_ROOT"
Quote:

> I have a server that just upgraded from 32 bit to 64 bit SBS. Now all
their
Quote:

> database report scripts are broken. The ODBC connection is 32bit. When run
> from a 32bit command prompt, the database access works fine. The problem
is
Quote:

> I can't get the email connection to work. The scripts use CDO to send the
> email results of the reports.
>
> The email code works in a 64bit command prompt. But I can't get it to work
> in a 32 bit command prompt.
>
> At line;
> objEmail = CreateObject("CDO.Message")
>
> I get an error of
> Error: "Library not registered."
> Code: 8002801D
> Source: (null)
>
> This is the same vbs file run under 64bit and 32bit mode.
>
> Any suggestions?
>
> Thanks,
> Bernie
>
>

My System SpecsSystem Spec
Old 07-10-2009   #3 (permalink)
David Kerber


 
 

Re: Conversion to 64 bit server

In article <uewX1KWAKHA.528@xxxxxx>, mayaXXyana@xxxxxx
says...
Quote:

>
>
> There are two typical problems whem registering
> on Vista/7. One is permissions. The other is that
> there are sort of two Registries.
>
> I haven't used 64-bit Windows. (I'm still wondering
> why anyone would use it, except maybe some game
Anybody who uses data sets large enough to need > 2GB of memory for good
performance: database, image and video editing, number crunching; or
who keeps several apps large running at a time (like me).

.....

--
/~\ The ASCII
\ / Ribbon Campaign
X Against HTML
/ \ Email!

Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).

My System SpecsSystem Spec
Old 07-10-2009   #4 (permalink)
Mark D. MacLachlan


 
 

Re: Conversion to 64 bit server

Bernie wrote:
Quote:

> I have a server that just upgraded from 32 bit to 64 bit SBS. Now all
> their database report scripts are broken. The ODBC connection is
> 32bit. When run from a 32bit command prompt, the database access
> works fine. The problem is I can't get the email connection to work.
> The scripts use CDO to send the email results of the reports.
>
> The email code works in a 64bit command prompt. But I can't get it to
> work in a 32 bit command prompt.
>
> At line;
> objEmail = CreateObject("CDO.Message")
>
> I get an error of
> Error: "Library not registered."
> Code: 8002801D
> Source: (null)
>
> This is the same vbs file run under 64bit and 32bit mode.
>
> Any suggestions?
>
> Thanks,
> Bernie
What code are you using to send the email. I've never had a problem
sending email via CDO on either architecture as long as there is an
SMTP server to connect to.

Here is some sample code that I use all the time:

Code:
Dim strFrom, strMyIP, strTo, strAttachmentPath

' Set the company specific information
strFrom = "username@xxxxxx"
' Set the SMTP server IP
strMyIP = "192.168.0.13"
' Where do you want the message to be delivered
' Use semicolons to seperate multiple addresses
strTo = "otheruser@xxxxxx"
strAttachmentPath = "\\server\share\file.txt"

' Set the visual basic constants as they do not exist within VBScript.
' Do not set your smtp server information here.
Const cdoSendUsingMethod =
"http://schemas.microsoft.com/cdo/configuration/sendusing", _
cdoSendUsingPort = 2, _
cdoSMTPServer =
"http://schemas.microsoft.com/cdo/configuration/smtpserver"

' Create the CDO connections.
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

' SMTP server configuration.
With Flds
..Item(cdoSendUsingMethod) = cdoSendUsingPort

' Set the SMTP server address here.
..Item(cdoSMTPServer) = strMyIP
..Update
End With

' Set the message properties.
With iMsg
Set .Configuration = iConf
..To = strTo
..From = strFrom
..Subject = "File Update"
..TextBody = "Here is the latest version of the file as of " & now
' An attachment can be included.
'.AddAttachment strAttachmentPath
End With

'Send high priority
iMsg.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High" '
For Outlook 2003
iMsg.Fields.Item("urn:schemas:mailheader:X-Priority") = 2 ' For Outlook
2003 also
iMsg.Fields.Item("urn:schemas:httpmail:importance") = 2 ' For Outlook
Express
iMsg.Fields.Update

'Send the message.
iMsg.Send

MsgBox "Done"
--

My System SpecsSystem Spec
Old 07-11-2009   #5 (permalink)
Bernie


 
 

Re: Conversion to 64 bit server

Mark,

Using your code I have listed it below;

I open a 32 bit cmd windows using "C:\Windows\SysWOW64\cmd.exe".
Navigate to the folder holding the script and run "testemail3.vbs".
I get the error;
Script: C:\Program Files (x86)\Scripts\testemail3.vbs
Line:
Char: 1
Error: Library not registered
Code: 8002801D
Source: (null)

Your code is basically the same as mine. I used authentication so I could
relay a copy out of the domain, but the send message is the same.

Have you ever run your code in 32bit mode on a 64bit os?

Any thoughts?

Bernie

Code:
Dim strFrom, strMyIP, strTo, strAttachmentPath

' Set the company specific information
strFrom = "bhunt@xxxxxx"
' Set the SMTP server IP
strMyIP = "192.168.1.12"
' Where do you want the message to be delivered
' Use semicolons to seperate multiple addresses
strTo = "bhunt@xxxxxx"
'strAttachmentPath = "\\server\share\file.txt"

' Set the visual basic constants as they do not exist within VBScript.
' Do not set your smtp server information here.
Const cdoSendUsingMethod =
"http://schemas.microsoft.com/cdo/configuration/sendusing", _
cdoSendUsingPort = 2, _
cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"

' Create the CDO connections.
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

' SMTP server configuration.
With Flds
..Item(cdoSendUsingMethod) = cdoSendUsingPort

' Set the SMTP server address here.
..Item(cdoSMTPServer) = strMyIP
..Update
End With

' Set the message properties.
With iMsg
Set .Configuration = iConf
..To = strTo
..From = strFrom
..Subject = "File Update"
..TextBody = "Here is the latest version of the file as of " & now
' An attachment can be included.
'.AddAttachment strAttachmentPath
End With

'Send high priority
iMsg.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High" 'For
Outlook 2003
iMsg.Fields.Item("urn:schemas:mailheader:X-Priority") = 2 ' For Outlook 2003
also
iMsg.Fields.Item("urn:schemas:httpmail:importance") = 2 ' For Outlook
Express
iMsg.Fields.Update

'Send the message.
iMsg.Send

MsgBox "Done"
"Mark D. MacLachlan" <markdmac@xxxxxx> wrote in message
news:usDWWEZAKHA.4984@xxxxxx
Quote:

> What code are you using to send the email. I've never had a problem
> sending email via CDO on either architecture as long as there is an
> SMTP server to connect to.
>
> Here is some sample code that I use all the time:
>
>
Code:
>
Code:
---snip ---
Quote:
>
Quote:

>
> --
>

My System SpecsSystem Spec
Old 07-11-2009   #6 (permalink)
Mark D. MacLachlan


 
 

Re: Conversion to 64 bit server

Bernie wrote:
Quote:

> Mark,
>
> Using your code I have listed it below;
>
> I open a 32 bit cmd windows using "C:\Windows\SysWOW64\cmd.exe".
> Navigate to the folder holding the script and run "testemail3.vbs".
> I get the error;
> Script: C:\Program Files (x86)\Scripts\testemail3.vbs
> Line:
> Char: 1
> Error: Library not registered
> Code: 8002801D
> Source: (null)
>
> Your code is basically the same as mine. I used authentication so I
> could relay a copy out of the domain, but the send message is the
> same.
>
> Have you ever run your code in 32bit mode on a 64bit os?
>
> Any thoughts?
>
> Bernie
>
>
Code:
> Dim strFrom, strMyIP, strTo, strAttachmentPath
>
> ' Set the company specific information
> strFrom = "bhunt@xxxxxx"
> ' Set the SMTP server IP
> strMyIP = "192.168.1.12"
> ' Where do you want the message to be delivered
> ' Use semicolons to seperate multiple addresses
> strTo = "bhunt@xxxxxx"
> 'strAttachmentPath = "\\server\share\file.txt"
>
> ' Set the visual basic constants as they do not exist within VBScript.
> ' Do not set your smtp server information here.
> Const cdoSendUsingMethod =
> "http://schemas.microsoft.com/cdo/configuration/sendusing", _
> cdoSendUsingPort = 2, _ cdoSMTPServer =
> "http://schemas.microsoft.com/cdo/configuration/smtpserver"
>
> ' Create the CDO connections.
> Dim iMsg, iConf, Flds
> Set iMsg = CreateObject("CDO.Message")
> Set iConf = CreateObject("CDO.Configuration")
> Set Flds = iConf.Fields
>
> ' SMTP server configuration.
> With Flds
> .Item(cdoSendUsingMethod) = cdoSendUsingPort
>
> ' Set the SMTP server address here.
> .Item(cdoSMTPServer) = strMyIP
> .Update
> End With
>
> ' Set the message properties.
> With iMsg
> Set .Configuration = iConf
> .To = strTo
> .From = strFrom
> .Subject = "File Update"
> .TextBody = "Here is the latest version of the file as of " & now
> ' An attachment can be included.
> '.AddAttachment strAttachmentPath
> End With
>
> 'Send high priority
> iMsg.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High"
> 'For Outlook 2003
> iMsg.Fields.Item("urn:schemas:mailheader:X-Priority") = 2 ' For
> Outlook 2003 also iMsg.Fields.Item("urn:schemas:httpmail:importance")
> = 2 ' For Outlook Express iMsg.Fields.Update
>
> 'Send the message.
> iMsg.Send
>
> MsgBox "Done"
>
>
>
> "Mark D. MacLachlan" <markdmac@xxxxxx> wrote in message
> news:usDWWEZAKHA.4984@xxxxxx
Quote:

> > What code are you using to send the email. I've never had a problem
> > sending email via CDO on either architecture as long as there is an
> > SMTP server to connect to.
> >
> > Here is some sample code that I use all the time:
> >
> >
Code:
> >
Code:
> ---snip ---
Quote:
> >
Quote:

> >
> > --
Are you launching that command prompt elevated as admin?

--

My System SpecsSystem Spec
Old 07-12-2009   #7 (permalink)
Bernie


 
 

Re: Conversion to 64 bit server


"Mark D. MacLachlan" <markdmac@xxxxxx> wrote in message
news:eVRrQ4mAKHA.4016@xxxxxx
--- snip ---
Quote:

>
> Are you launching that command prompt elevated as admin?
>
Yes. I right clicked and selected "Run as administrator" and I verified that
the title bar of the command prompt form says "Administrator: 32Bit CMD".

Bernie


My System SpecsSystem Spec
Old 07-12-2009   #8 (permalink)
Mark D. MacLachlan


 
 

Re: Conversion to 64 bit server

Bernie wrote:
Quote:

>
> "Mark D. MacLachlan" <markdmac@xxxxxx> wrote in message
> news:eVRrQ4mAKHA.4016@xxxxxx --- snip ---
Quote:

> >
> > Are you launching that command prompt elevated as admin?
> >
>
> Yes. I right clicked and selected "Run as administrator" and I
> verified that the title bar of the command prompt form says
> "Administrator: 32Bit CMD".
>
> Bernie
Hmm very strange. I am running that same code on my Windows 7 x64
machine. Email is received as it should be. I tried running as you
describe by manually launching command prompt from within syswow64
directory and then running the script via CSCRIPT. I also executed it
directly from within my VBSEdit program which is 32 bit. In both cases
I received the email.

Sounds to me like you may not have a DLL registered somewhere.

I wonder if this might help? http://www.mskbarticles.com/?kb=945835

Total speculation on my part, that link is intended for servers after
upgrading to Exchange 2007.

Hope that helps,

Mark


--

My System SpecsSystem Spec
Old 07-13-2009   #9 (permalink)
Alex K. Angelopoulos


 
 

Re: Conversion to 64 bit server

Bernie,

Your problem is due to the fact that by default WSH scripts are run with the
64-bit script host on 64-bit Windows versions. Since 32-bit processes cannot
load 64-bit components and 64-bit processes cannot load 32-bit components,
if a script running in 64-bit WScript/CScript tries to load a component
without a 64-bit implementation, it won't be able to find it.

For the most common Microsoft-sourced components this isn't an issue because
there are 64-bit implementations of them. Unfortunately, less common ones -
such as CDO, ODBC drivers, and the Microsoft Script Control - don't have
64-bit implementations. (By the way, this is why 64-bit Windows uses 32-bit
MSHTA and 32-bit IE by default; too many specialty components just don't run
in them).

The simplest ways to work around the problem are going to be one of the
following:

(1) Explicitly specify the correct version of WSH to use.
If you're running this script from something like a scheduled task, you can
try explicitly specifying the 32-bit version of the script host, which
resides in the SysWow64 folder. So, for example, if you need 32-bit
wscript.exe and SBS is installed in the directory C:\Windows, then you'd
want to run it with C:\Windows\SysWow64\wscript.exe.

(2) Configure Windows to use 32-bit WSH for scripts of interest
This probably makes the most sense for traditional networks. There are a
couple of ways to approach this.
The simplest for just VBScript files is to open regedit and navigate to
HKCR\VBSFile\Shell\Open\Command. Its default value should be something like
"%SystemRoot%\System32\WScript.exe" "%1" %*
Simply change this to
"%SystemRoot%\SysWow64\WScript.exe" "%1" %*
This can get more complicated if you need to specify it for many types of
WSH scripts, since you'd need to hunt up the associations used for
vbs/js/vbe/jse/wsf/wsh extensions. If you need a more general solution, I
can post a fix for it.

"Bernie" <bernie@xxxxxx> wrote in message
news:ea7yYVUAKHA.4984@xxxxxx
Quote:

> I have a server that just upgraded from 32 bit to 64 bit SBS. Now all
> their database report scripts are broken. The ODBC connection is 32bit.
> When run from a 32bit command prompt, the database access works fine. The
> problem is I can't get the email connection to work. The scripts use CDO
> to send the email results of the reports.
>
> The email code works in a 64bit command prompt. But I can't get it to work
> in a 32 bit command prompt.
>
> At line;
> objEmail = CreateObject("CDO.Message")
>
> I get an error of
> Error: "Library not registered."
> Code: 8002801D
> Source: (null)
>
> This is the same vbs file run under 64bit and 32bit mode.
>
> Any suggestions?
>
> Thanks,
> Bernie
>
>
My System SpecsSystem Spec
Old 07-13-2009   #10 (permalink)
Alex K. Angelopoulos


 
 

Re: Conversion to 64 bit server

My apologies, I didn't read all the way through your description of the
problem; you're aware of the 32/64 issues. It appears that you don't have a
32-bit cdosys.dll registered on the system. Could you confirm the following?

(1) Make sure the line where you instantiate CDO.Message actually includes
the "set" keyword - I suspect it does and you just cut it off by accident in
post.

(2) Confirm that you have a file named cdosys.dll in the SysWow64 folder.

(3) From an elevated command prompt, register the file if it exists using
regsvr32, e.g.,
regsvr32 C:\Windows\SysWOW64\cdosys.dll


"Alex K. Angelopoulos" <alex(dot) k(dot again)angelopoulos(at)gmail.com>
wrote in message news:#FZHPs3AKHA.1376@xxxxxx
Quote:

> Bernie,
>
> Your problem is due to the fact that by default WSH scripts are run with
> the 64-bit script host on 64-bit Windows versions. Since 32-bit processes
> cannot load 64-bit components and 64-bit processes cannot load 32-bit
> components, if a script running in 64-bit WScript/CScript tries to load a
> component without a 64-bit implementation, it won't be able to find it.
>
> For the most common Microsoft-sourced components this isn't an issue
> because there are 64-bit implementations of them. Unfortunately, less
> common ones - such as CDO, ODBC drivers, and the Microsoft Script
> Control - don't have 64-bit implementations. (By the way, this is why
> 64-bit Windows uses 32-bit MSHTA and 32-bit IE by default; too many
> specialty components just don't run in them).
>
> The simplest ways to work around the problem are going to be one of the
> following:
>
> (1) Explicitly specify the correct version of WSH to use.
> If you're running this script from something like a scheduled task, you
> can try explicitly specifying the 32-bit version of the script host, which
> resides in the SysWow64 folder. So, for example, if you need 32-bit
> wscript.exe and SBS is installed in the directory C:\Windows, then you'd
> want to run it with C:\Windows\SysWow64\wscript.exe.
>
> (2) Configure Windows to use 32-bit WSH for scripts of interest
> This probably makes the most sense for traditional networks. There are a
> couple of ways to approach this.
> The simplest for just VBScript files is to open regedit and navigate to
> HKCR\VBSFile\Shell\Open\Command. Its default value should be something
> like
> "%SystemRoot%\System32\WScript.exe" "%1" %*
> Simply change this to
> "%SystemRoot%\SysWow64\WScript.exe" "%1" %*
> This can get more complicated if you need to specify it for many types of
> WSH scripts, since you'd need to hunt up the associations used for
> vbs/js/vbe/jse/wsf/wsh extensions. If you need a more general solution, I
> can post a fix for it.
>
> "Bernie" <bernie@xxxxxx> wrote in message
> news:ea7yYVUAKHA.4984@xxxxxx
Quote:

>> I have a server that just upgraded from 32 bit to 64 bit SBS. Now all
>> their database report scripts are broken. The ODBC connection is 32bit.
>> When run from a 32bit command prompt, the database access works fine. The
>> problem is I can't get the email connection to work. The scripts use CDO
>> to send the email results of the reports.
>>
>> The email code works in a 64bit command prompt. But I can't get it to
>> work in a 32 bit command prompt.
>>
>> At line;
>> objEmail = CreateObject("CDO.Message")
>>
>> I get an error of
>> Error: "Library not registered."
>> Code: 8002801D
>> Source: (null)
>>
>> This is the same vbs file run under 64bit and 32bit mode.
>>
>> Any suggestions?
>>
>> Thanks,
>> Bernie
>>
>>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
WAV to MP3 Conversion through VB.Net (3.5) .NET General
Win 7 conversion Live Mail
Conversion Vista General
VHS Conversion Vista hardware & devices
Parsing IIS web server logs + time-series conversion PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46