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

x
  • 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
 else
  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
 Else
  ' 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"
 
0
pjbroe
Asked:
pjbroe
  • 2
1 Solution
 
Dariusz DziaraProgrammerCommented:
1. Do you have such registry key ?

REGEDIT4

[HKEY_CLASSES_ROOT\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}]
@="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}]

[HKEY_CLASSES_ROOT\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}\InProcServer32]
@="C:\\WINDOWXP\\system32\\wshom.ocx"
"ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}\ProgID]
@="WScript.Shell.1"

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

[HKEY_CLASSES_ROOT\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}\TypeLib]
@="{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}"

[HKEY_CLASSES_ROOT\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}\VersionIndependentProgID]
@="WScript.Shell"

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

Dim obj

Set obj = CreateObject("WScript.Shell")

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

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

and it still works
0

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