+ Reply to Thread
Results 1 to 4 of 4

Thread: VBScript and 'Scripting.filesystemobject'

  Share/Bookmark
  1. #1

    Reputation

    Join Date
    Feb 2008
    Location
    N wales
    Posts
    20
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default VBScript and 'Scripting.filesystemobject'

    Morning everyone

    I have set the following VBS script to run when our computers start up along with delprof.exe to get rid of any locally cached profiles.

    Code:
    Const LocalDocumentsFolder = "C:\Documents and Settings\"
    
    set objFSO = createobject("Scripting.FileSystemObject")
    set objFolder = objFSO.GetFolder(localdocumentsfolder)
    
    for each fldr in objFolder.SubFolders
    	if not isexception(fldr.name) then 
    		objFSO.DeleteFolder fldr.path, True
    	end if
    next
    
    
    Function isException(byval foldername)
    	select case foldername
    		case "All Users"
    			isException = True
    		case "Default User"
    			isException = True
    		case "LocalService"
    			isException = True
    		case "NetworkService"
    			isException = True
    		case "Administrator"
    			isException = True
    		case Else
    			isException = False
    	End Select
    End Function
    
    it works perfectly on all our computers and even our terminal servers, well all except one! Its a terminal server running windows 2003 R2 and I get the following error

    activex component can't create object:'Scripting.filesystemobject' in line 3 char1

    Anyone have any ideas at a total loss here!

  2. #2

    Reputation
    binky's Avatar
    Join Date
    Sep 2006
    Posts
    293
    Thank Post
    1
    Thanked 19 Times in 16 Posts
    Rep Power
    0

    Default

    Try reinstalling Windows Scripting Host on the computer.

  3. 2 Thanks to binky:

    placky (01-04-2008), SteveMC (18-02-2010)

  4. #3

    Reputation

    Join Date
    Jan 2007
    Location
    Enfield, London
    Posts
    153
    Thank Post
    7
    Thanked 2 Times in 2 Posts
    Rep Power
    9

    Default

    Quote Originally Posted by placky View Post
    activex component can't create object:'Scripting.filesystemobject' in line 3 char1

    Anyone have any ideas at a total loss here!
    Are you using seperate copies on each machine of the same script. You may need to check how exactly you spelt Scripting.FileSystemObject. The only may I could get the same error was to mistype the name of the object between the quote marks.

  5. #4

    Reputation

    Join Date
    Feb 2008
    Location
    N wales
    Posts
    20
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Thanks for the help Binky and m2d2!

    A reinstall of the Scripting Host fixed it

    Regards

    Gareth

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. VBScript IDE + Debugger
    By Geoff in forum Scripts
    Replies: 4
    Last Post: 13-09-2007, 08:56 PM
  2. VBScript / SQL Server
    By Gatt in forum Scripts
    Replies: 5
    Last Post: 23-05-2007, 02:12 PM
  3. another VBScript question!
    By StewartKnight in forum Coding
    Replies: 4
    Last Post: 03-05-2007, 05:41 PM
  4. FileSystemObject Folder why permission denied
    By NetworkGeezer in forum Coding
    Replies: 15
    Last Post: 03-05-2007, 05:34 PM
  5. VBScript
    By StewartKnight in forum Coding
    Replies: 5
    Last Post: 01-05-2007, 11:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts