# Getting error when creating new instance of Wscript object

**URL:** <https://www.ruby-forum.com/t/getting-error-when-creating-new-instance-of-wscript-object/132575>\
**Category:** Ruby\
**Created:** [March 21, 2008, 4:32pm UTC](https://www.ruby-forum.com/t/getting-error-when-creating-new-instance-of-wscript-object/132575 "2008-03-21T16:32:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [March 21, 2008, 4:32pm UTC](https://www.ruby-forum.com/t/getting-error-when-creating-new-instance-of-wscript-object/132575/1 "2008-03-21T16:32:21Z")

</div>

Hi,

I performed the following:

require ‘win32ole’

Now, when I create a new instance of Wscript shell object, I get the  
following error in the output window:

wsh = WIN32OLE.new(‘Wscript.Shell’)

invokingnotepadwsh.rb:4:in `initialize': failed to create WIN32OLE object from`Wscript.Shell’ (WIN32OLERuntimeError)  
HRESULT error code:0x8007007e  
The specified module could not be found. from  
invokingnotepadwsh.rb:4:in `new’  
from invokingnotepadwsh.rb:4

> Exit code: 1

Can anyone please help how to debug this? Is there anything wrong with  
the code?

Thanks,  
Anukul

---

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [March 22, 2008, 3:51am UTC](https://www.ruby-forum.com/t/getting-error-when-creating-new-instance-of-wscript-object/132575/2 "2008-03-22T03:51:18Z")

</div>

Anukul S. wrote:

> Hi,
> 
> I performed the following:
> 
> require ‘win32ole’
> 
> Now, when I create a new instance of Wscript shell object, I get the  
> following error in the output window:
> 
> wsh = WIN32OLE.new(‘Wscript.Shell’)
> 
> invokingnotepadwsh.rb:4:in `initialize': failed to create WIN32OLE object from `Wscript.Shell’ (WIN32OLERuntimeError)  
> HRESULT error code:0x8007007e  
> The specified module could not be found. from  
> invokingnotepadwsh.rb:4:in `new’  
> from invokingnotepadwsh.rb:4
> 
> > Exit code: 1
> 
> Can anyone please help how to debug this? Is there anything wrong with  
> the code?
> 
> Thanks,  
> Anukul

This error may occur if your Windows Script installation is corrupted.  
You might try reinstalling Windows Script from the Microsoft website.

David

> **[Ruby on Windows](http://rubyonwindows.blogspot.com)**
>
> On using the Ruby programming language on the Microsoft Windows platform

---

<div class="post-metadata">

**Author:** ![anukulsinghal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@anukulsinghal](https://www.ruby-forum.com/u/anukulsinghal)\
**Post date:** [March 22, 2008, 7:37am UTC](https://www.ruby-forum.com/t/getting-error-when-creating-new-instance-of-wscript-object/132575/3 "2008-03-22T07:37:41Z")

</div>

David M. wrote:

> Anukul S. wrote:
> 
> > Hi,
> > 
> > I performed the following:
> > 
> > require ‘win32ole’
> > 
> > Now, when I create a new instance of Wscript shell object, I get the  
> > following error in the output window:
> > 
> > wsh = WIN32OLE.new(‘Wscript.Shell’)
> > 
> > invokingnotepadwsh.rb:4:in `initialize': failed to create WIN32OLE object from `Wscript.Shell’ (WIN32OLERuntimeError)  
> > HRESULT error code:0x8007007e  
> > The specified module could not be found. from  
> > invokingnotepadwsh.rb:4:in `new’  
> > from invokingnotepadwsh.rb:4
> > 
> > > Exit code: 1
> > 
> > Can anyone please help how to debug this? Is there anything wrong with  
> > the code?
> > 
> > Thanks,  
> > Anukul
> 
> This error may occur if your Windows Script installation is corrupted.  
> You might try reinstalling Windows Script from the Microsoft website.
> 
> David
> 
> [http://rubyonwindows.blogspot.com](http://rubyonwindows.blogspot.com)

The OS on my system is Windows Vista. I tried to get WSH5.7 for Windows  
Vista but could not get one. Can you please help where I can download  
the WSH which is compatible with Windows Vista?

Thanks,  
Anukul
