I have a simple vbs-file on my drive c: with following content:
Set objShell = CreateObject("Scripting.FileSystemObject")
When I’m trying to launch it, I get error
c:fso.vbs(1, 1) Microsoft VBScript
runtime error: ActiveX component can’t
create object:
‘Scripting.FileSystemObject’
I tried to login as admin and execute wscript -regserver
, but didn’t help.
Can someone help me please?
asked Mar 28, 2011 at 9:27
Assuming you are logged in as Admin, please have a look in registry for Scripting.FileSystemObject
under HKCR.
If you can not find this PROGID then you are missing the required files or the component is disabled (not registered).
Scripting.FileSystemObject
is implemented in scrrun.dll.
bluish
26.1k27 gold badges120 silver badges179 bronze badges
answered Mar 28, 2011 at 9:42
bytebyte
1,6651 gold badge19 silver badges36 bronze badges
4
If re-registering scrrun.dll doesn’t fix it, you might have to re-register a lot of other dependencies. The easiest way to do that is with MS Fixit 50123:
http://go.microsoft.com/?linkid=9666880
Run that, then try your FSO call again. This is the only thing that worked for me on a couple client computers that had various fake AV programs and reg cleaners.
answered Aug 31, 2015 at 5:04
shawnshawn
3832 silver badges8 bronze badges
1
In my case ProgId
attribute on the COM component class was misspelled:
[ProgId("XXX")]
answered Mar 20, 2017 at 13:19
Алексей,
Похоже, что очередные ужесточения политики безопасности Microsoft.
Ранее была описана процедура отключения FileSystemObject. Вполне возможно, что теперь эту процедуру попросту ВКЛЮЧИЛИ … официальной информации пока не видел. (У самих возникли проблемы — сейчас создам отдельный вопрос.)
http://download.microsoft.com/download/7/3/e/73e69052-e497-4b00-b2a6-62e43af6f3f6/Securing%20Internet%20Information%20Services%206.0.doc
Disabling the FileSystemObject Component
ASP, Windows Script Host, and other scripting applications use the FileSystemObject (FSO) component to create, delete, gain information about and manipulate drives, folders, and files. Consider disabling the FSO component, but be aware that this will also remove the Dictionary object. Also, verify that no other programs require this component.
Requirements
You will need the following to complete this task:
· Credentials. You must be logged on as a member of the Administrators group on the Web server.
· Tools. Command prompt.
To disable the FileSystemObject component
1. Click Start, click Run, type cmd in the Open box, and then click OK.
2. Type cd c:Windowssystem32 and press ENTER to change to the C:Windowssystem32 directory.
3. At the command prompt, type regsvr32 scrrun.dll /u and then press ENTER. The following message will display:
DllUnregisterServer in scrrun.dll succeeded.
1. Click OK.
2. At the command prompt, type exit and press ENTER to close the command prompt window.
I am getting an error in a .vbs file (and similar error in a .js file) when run from a Visual Studio batch file:
Error in CreateObject(Scripting.FileSystemObject): ActiveX component can’t create object. A code excerpt follows:
Err.Clear on error Resume Next Set oFSO = CreateObject("Scripting.FileSystemObject") If Err.Number <> 0 Then WScript.Echo "Error in CreateObject(Scripting.FileSystemObject): " & Err.Description & " (so updating without regard to file modification times)" Err.Clear WScript.Sleep 2000 bRun = 1 End If
This used to work, and the .vbs file will work fine if run from a command prompt. How can I narrow down the problem and correct?
A JavaScript excerpt where a similar error occurs:
function DetectAndMoveSettings(){ var fso = new ActiveXObject("Scripting.FileSystemObject"); << similar error here var newSettings = Editor.pluginConfigDir+"\jN.settings.js"; if (fso.FileExists(newSettings)) return;
I am using Windows 7 64-bit.
I know that my system files are intact (sfc /scannow), but maybe the registry is not.
Regards,
Frank
Looking back, I find this error popping up in my case notes once or twice every year.
Sometimes we’re able to help fix the problem, sometimes not, because it’s a problem with their system, not with Softimage itself.
Typically, a user will report seeing errors like this at start up:
// ERROR : Automation server can't create object - [line 22 in c:Program FilesAutodeskSoftimage 2012 SP1AddonsICEFlowBuilderApplicationPluginsICEFlowCreateParticlesPlugin.js] // ERROR : Automation server can't create object - [line 70 in c:Program FilesAutodeskSoftimage 2012 SP1AddonssdkuiApplicationPluginsAddonDoc.js] // ERROR : Automation server can't create object - [line 141 in c:Program FilesAutodeskSoftimage 2012 SP1ApplicationCommandsGlobalVarPlugin.js] // ERROR : 2006-SetGlobal - Unexpected failure. // ERROR : Automation server can't create object - [line 141 in c:Program FilesAutodeskSoftimage 2012 SP1ApplicationCommandsGlobalVarPlugin.js] // ERROR : 2006-GetGlobal - Unexpected failure. // ERROR : Automation server can't create object - [line 141 in c:Program FilesAutodeskSoftimage 2012 SP1ApplicationCommandsGlobalVarPlugin.js] // ERROR : 2006-GetGlobal - Unexpected failure. // ERROR : Automation server can't create object - [line 141 in c:Program FilesAutodeskSoftimage 2012 SP1ApplicationCommandsGlobalVarPlugin.js] // ERROR : 2006-GetGlobal - Unexpected failure.
Sometimes users miss the startup errors and report seeing the error when they try to do something in Softimage, such as import dotXSI.
// ERROR : ActiveX component can't create object: 'Scripting.FileSystemObject' - [line 352 in c:Program FilesAutodeskSoftimage 2012 SP1ApplicationDSScriptsModel.vbs] ImportDotXSI(null, null);
Note that the errors all give a line number in a specific file. If you check any of these, you’ll see that all the errors happen when Softimage tries to create an ActiveX object like
Scripting.Dictionary or Scripting.FileSystemObject. These are standard objects in the Microsoft Windows Script runtime, so these errors indicate that something’s wrong with Windows.
If you’re lucky, you can fix this by re-registering C:windowssystem32scrrun.dll with regsvr32.
If that doesn’t work, then my guess would be that it’s some kind of registry or permissions problem. In the past (on XP systems), I’ve seen cases where it was specific to a user profile, and where it was because the Scripting.FileSystemObject registry key didn’t have an owner assigned.
If you don’t believe it’s a general Windows problem, try this. It should give the same error.
- Open a command prompt.
- Run this command: notepad test.vbs
- In notepad, paste in this VBScript and save the file:
set fso = CreateObject("Scripting.FileSystemObject") set fout = fso.CreateTextFile("c:Test.txt", true) fout.WriteLine Now fout.Close WScript.Echo "Testing"
- In the command prompt, run this command: cscript test.vbs
Hi,
I’ve got this error (ActiveX Component can’t create object «»Scripting.FileSystemObject»») when I lanch a macro to upload a file with a FTP.
The script is:
sub Upload
set vPath = ActiveDocument.Variables("vPathFile").GetContent
Dim FSO
Dim File
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile("C:temp.txt", 2, True)
File.WriteLine "open ***-ftp.*************"
File.WriteLine "user"
File.WriteLine "****"
File.WriteLine "*****"
File.WriteLine "cd qlikview/prodis"
File.WriteLine "PUT "& vPath.string
File.WriteLine "disconnect"
File.WriteLine "quit"
Dim shell
Set shell = CreateObject("WScript.Shell")
shell.Run "ftp -n -s:C:temp.txt"
End Sub
If i lanch this macro like this, there is no problem…
but if I change the path of the .txt file for example: * **
C:UsersPublicDocumentstemp.txt
I’ve got an error….
The problem is the users are not Adminstrateur of their computer, so they can’t create a txt file in C:
that’s why i want to change the path, like that…
I don’t know why ActiveX can’t create the object with this path wheras it works whith an other.
(My macro has system Access, it’s not the problem)
Thanks
DUEZ Thomas