Solved

Error trying to use Server.CreateObject("Scripting.FileSystemObject") to browse local system

Posted on 2006-10-30
14
825 Views
Last Modified: 2008-01-09
I have a windows XP SP 2 system and I am trying to use the following code to browse documents in a specified folder on my system.

I get this error message


Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid class string


The code is

<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0 ID="Table3" width=100%>
<TR BGCOLOR="#000000">
      <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Form</B></FONT></TD>
      <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Filename:</B></FONT></TD>
      <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Size:</B></FONT></TD>
      <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>File type:</B></FONT></TD>
      <TD class=inputbox><FONT COLOR="#FFFFFF"><B>Date created:</B></FONT></TD>
<%
' Create an instance of the FileSystemObject
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
' Create Folder Object
Set MyFolder=MyFileObject.GetFolder(Server.MapPath("../forms"))
'Loop trough the files in the folder
FOR EACH thing in MyFolder.Files
%>
<TR BGCOLOR="#F7F7E7">
      <TD  class=inputbox><img src="../forms/<%=thing.Name%>" width=50></TD>
      <TD  class=inputbox><A HREF="../forms/<%=thing.Name%>"><%=thing.Name%></A></TD>
      <TD ALIGN=RIGHT><%=thing.Size%>bytes</TD>
      <TD  class=inputbox><%=thing.Type%></TD>
      <TD><%=thing.DateCreated%></TD>
<%
NEXT
%>
</TABLE>

Very Important to get the asnwer ASAP

Thanks in advance.
0
Comment
Question by:souldj
14 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
What line is throwing the error?

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
For troubleshooting, let's try this:

<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0 ID="Table3" width=100%>
<TR BGCOLOR="#000000">
     <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Form</B></FONT></TD>
     <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Filename:</B></FONT></TD>
     <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Size:</B></FONT></TD>
     <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>File type:</B></FONT></TD>
     <TD class=inputbox><FONT COLOR="#FFFFFF"><B>Date created:</B></FONT></TD>
<%
' Create an instance of the FileSystemObject
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
If IsObject(MyFileObject) Then
      response.write "MyFileObjectCreated"
Else
      response.write "Could not create object"
End If
response.end
' Create Folder Object
Set MyFolder=MyFileObject.GetFolder(Server.MapPath("../forms"))
'Loop trough the files in the folder
FOR EACH thing in MyFolder.Files
%>
<TR BGCOLOR="#F7F7E7">
     <TD  class=inputbox><img src="../forms/<%=thing.Name%>" width=50></TD>
     <TD  class=inputbox><A HREF="../forms/<%=thing.Name%>"><%=thing.Name%></A></TD>
     <TD ALIGN=RIGHT><%=thing.Size%>bytes</TD>
     <TD  class=inputbox><%=thing.Type%></TD>
     <TD><%=thing.DateCreated%></TD>
<%
NEXT
%>
0
 
LVL 1

Author Comment

by:souldj
Comment Utility
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")

This is the line giving the error.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
Take a look at the last post in this thread:

http://www.thescripts.com/forum/thread460883.html

FtB
0
 
LVL 25

Expert Comment

by:Lee Savidge
Comment Utility
Hi,

Invalid class string means the DLL that your trying to reference is not registered on the machine. You will need to download the scripting dll from Microsoft. It is called scrrun.dll. It may be on your installation media.

Regards,

Lee
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
Lee--

Sometimes that is the case, but other times it appears that inadequate permission settings results in the same error message.

FtB
0
 
LVL 1

Author Comment

by:souldj
Comment Utility
Based on the URL provided by fritz_the_blank, I got


1) Logged onto the machine as an administrator, without the network being
connected.

2) Start > Run > regedit

3) HKEY_LOCAL_Machine > SOFTWARE > Classes > Scripting.FileSystemObject

4) Right Click and select Permissions.
If yours is like mine, there will be only one or two there.
Add the permissions for all the normal users - System, IUSR_..., Guests,
Administrator

5) HKEY_LOCAL_Machine > SOFTWARE > Classes > CLSID
Search for this {0D43FE01-F093-11CF-8940-00A0C9054228}
Add the same permissions that you added to #4

6) Save the registry

7) Reboot, cross your fingers and anything else that will cross (it worked
for me anyway)

8) Test your FSO program again, mine worked, I hope yours does as well.




I searched for the registry itme  HKEY_LOCAL_Machine > SOFTWARE > Classes > Scripting.FileSystemObject but when I got it , it had no values and allowed me to add no values to it.

What next? Is it time to ReInstall?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 12

Expert Comment

by:sandip132
Comment Utility
you need to adjust the permissions on the SCRRUN.DLL.
Here's how you do it:
Navigate to your WINNT\SYSTEM32 directory and find the SCRRUN.DLL. Right-click the file and select properties. Then click the security tab and ensure that the IUSR_<machinename> and IWAM_<machinename> accounts have "read" and "read & execute" permissions. That's it.
0
 
LVL 1

Author Comment

by:souldj
Comment Utility
My machine name is Blueice and so I have added the users IUSR_blueice and IWAM_blueice to the permissions on the file SCRRUN.DLL and still getting the same error message
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
Things are looking grim.

What if you create a .vbs file and run it on the machine when you are logged in as an administrator? If that works, then you know that the .dll is present, registered, and functioning. Moreover, that will point to a permissions error. If, on the other hand, that does not work, then that permissions are not the issue.

FtB

0
 
LVL 1

Author Comment

by:souldj
Comment Utility
Can you give me a simple vbs file to run on my system? or recommend the code for one as I have never written one before
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
Paste the following into a text file and save it with a .vbs extention and then double click the file to execute it:

' Create an instance of the FileSystemObject
Set MyFileObject=CreateObject("Scripting.FileSystemObject")
' Create Folder Object
Set MyFolder=MyFileObject.GetFolder("C:\YourDirectoryGoesHere")
'Loop trough the files in the folder
FOR EACH thing in MyFolder.Files
      msgBox thing.Name
NEXT
0
 
LVL 1

Author Comment

by:souldj
Comment Utility
Error was encountered.

Line 4 Char 1
Active X component can't create object "Scripting.FileSystemObject
Code: 800A01AD
Microsoft VDScript runtine Error


What now?
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 500 total points
Comment Utility
It seems that there may be something wrong with the .dll as Lee suggested. This might help:


http://support.microsoft.com/default.aspx/kb/194801
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now