Problem referencing FileSystemObject

KeithWilliams

Registered User.
Local time
Today, 15:28
Joined
Feb 9, 2004
Messages
137
Hi,

I have the following function on a form:
Code:
Private Function GetCitrixClientHardDrive()
    Dim objFileSystem As Object, objDrive As Object, objDriveCollection As Object
    
    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    Set objDriveCollection = objFileSystem.Drives
    For Each objDrive In objDriveCollection
        If InStr(objDrive.ShareName, "C$") > 0 And InStr(objDrive.ShareName, "Client") > 0 Then
            GetCitrixClientHardDrive = objDrive.DriveLetter
            Exit Function
        End If
    Next
    
    GetCitrixClientHardDrive = ""
End Function

This is failing on the first line, CreateObject("Scripting.FileSystemObject"), with the error:
Run-time error '-2147024770 (8007007e)':

Automation error
The specified module could not be found.

This application ran fine on a new PC with Office 2003 installed. However, it fails with the above error when run via Citrix on a Citrix Server with Office 2003 again newly installed. I have checked it on the Citrix server in debug mode, and there are no missing references in Tools>References. I have even added the Microsoft Scripting Library (scrrun.dll) as a reference, although it was not needed on my machine, but this made no difference.

I would greatly appreciate any suggestions on what to try next!

Thanks,
Keith.
 
Just a quick "thought off the top of me head", do you have permissions to see those objects on the Citrix Server?
 
Hi,

I'm not aware of any permissions issues. If I didn't have access to see and run the DLLs, I think the whole application would fail.

Keith.
 
Hi,

I have now tried this directly on the server, so without the Citrix software being involved. I get the same error. I have confirmed I can view and create files in C:\Windows\System32, so I don't think it is a permissions problem.

It seems as though the difference between my PC, where it works, and the server, where it doesn't, is that my PC runs Windows XP and the server runs Windows Server 2003.

Is anyone else able to try running the line of code
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
on a Windows Server 2003 machine?

Thanks,
Keith.

PS please help me with this before it drives me crazy!
 
Last edited:
Hi,

Just to close this issue, it is fixed by running on Windows Server 2003 with Service Pack 1 applied. So looks like a bug in the initial release of Windows Server 2003.

Keith.
 
Oops, spoke too soon! We had it working on a server with Windows Server 2003 SP1, but we were not able to get it working on the server where we need it, even after applying the Service Pack.

We suspect it may be because the problem server is also running MS Terminal Server and Citrix. I have a case open with Microsoft to try and get this resolved.

Thanks,
Keith.
 
Do you have scripting loaded on that server? It is hard to instantiate an object if it does not exist.
 
Hi,

How would I know if I had scripting loaded on the server? I have tried adding Microsoft Scripting Runtime to the References, but this had no effect (and is not needed to run the application under Windows XP on my PC.

Thanks,
Keith.
 
You could save this as a VBS file on the server's local HD and try to run it and see if it runs OK from a CMD line on the server.
Code:
// Change to your folder you want the size of 
var folder = "F:\\winnt";

// Create FSO and Grab the folder you defined  
var fso = new ActiveXObject( "Scripting.FileSystemObject" );
var fl = fso.GetFolder( folder );

  
// Get the byte size of folder and sub folders. Format
// into MB as well.
var byteSize = fl.Size;
var mbSize = new String( byteSize / 1048576 ).substr( 0, 5 );

// Create display message
var msg  = "The size of " + folder + " is\n";
    msg += byteSize + " (bytes)\n";
    msg += mbSize + " MB\n";
	
// Show it 
WScript.Echo(  msg  );
 
Hi,

I tried this and got the following error:

(title) Windows Script Host

(message)
Script: C:\TEMP\keithtest.vbs
Line: 1
Char: 1
Error: Expected statement
Code: 800A0400
Source: Microsoft VBScript compilation error.

Is this what you would expect? It looks as though it could not recognize the first comment line. Is it correct that windows invokes Windows Script Host to run a VBScript program? (I've never used it before).

Thanks,
Keith.
 

Users who are viewing this thread

Back
Top Bottom