Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8363
  • Last Modified:

ActiveX component can't create object: 'WScript.Shell'

This is the file that the problem occurs in.. prefastnew.dsm:
Sub PrefastNew()
'DESCRIPTION: Reads the compilation options from the active project and compiles the active file with Prefast using these options
 Dim PathString
 If Application.Documents.Count > 0 then
  PathString = ActiveDocument.FullName
  Exit Sub
 End if
 Dim objShell
 Set objShell = CreateObject("WScript.Shell")
 Dim Args
 If Projects Is Nothing Or Projects.Count < 1 Then
  ' Ask the user for preprocessor symbols e.g. _ADMIN. _DATASERVER, etc.
  ' Then prefast the actiuve file
  Args = "C:\Prefast\prefastnew.bat " & PathString
  ' Get the compile options from the current dsp
  ' Then prefast the active file
  Args = "cmd /V:on /c ""C:\Prefast\prefastnewVs6.bat " & ActiveProject.FullName & " " & ActiveDocument.FullName & """"
 End If
 objShell.Run Args
End Sub
This is the error:
Line 11: ActiveX component can't create object: 'WScript.Shell'
This is what I've tried:
My OS is Windows XP Version 5.1(build 2600.xpsp_sp2_gdr.050301-1519 : Service Pack 2)
I made all internet explorer security settings low to allow execution of all ActiveX components.
I checked that "C:\WINNT\System32\wshom.ocx" is present on the system
I tried running wscript -regserver
I tried adding the registry entry "Remote" with a value of 1 to "HKEY_LOCAL_ MACHINE\SOFTWARE\Microsoft\Windows Script Host\Settings" registry subkey
I ran regsvr32  /v C:\WINDOWS\system32\wshom.ocx and checked that this is registered correctly. It apppears fine in the registry.
I ran all windows updates and reinstalled Windows XP service pack 2.
Lots of help on the net suggest that the problem may be with the syntax of Set objShell = CreateObject("WScript.Shell").   This line is correct for it's current use and the problem seems to be only with the object "WScript.Shell"
  • 2
1 Solution
Dariusz DziaraProgrammerCommented:
1. Do you have such registry key ?


@="Windows Script Host Shell Object"

[HKEY_CLASSES_ROOT\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}\Implemented Categories]

[HKEY_CLASSES_ROOT\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}\Implemented Categories\{40FC6ED5-2438-11CF-A3DB-080036F12502}]






2. Does following "test.vbs" (create such file and fill with contents below) file executes successfully ?

Dim obj

Set obj = CreateObject("WScript.Shell")

Dariusz DziaraProgrammerCommented:
I have checked ".dsm" file (macro for Visual Studio project)
with following lines:

Dim obj
Set obj = CreateObject("WScript.Shell")

and it still works

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now