+ Post New Thread
Results 1 to 4 of 4
Scripts Thread, VBScript and 'Scripting.filesystemobject' in Coding and Web Development; Morning everyone I have set the following VBS script to run when our computers start up along with delprof.exe to ...
  1. #1
    placky's Avatar
    Join Date
    Feb 2008
    Location
    N wales
    Posts
    27
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    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
    binky's Avatar
    Join Date
    Sep 2006
    Posts
    290
    Thank Post
    1
    Thanked 19 Times in 16 Posts
    Rep Power
    0
    Try reinstalling Windows Scripting Host on the computer.

  3. 2 Thanks to binky:

    placky (1st April 2008), SteveMC (18th February 2010)

  4. #3

    Join Date
    Jan 2007
    Location
    Enfield, London
    Posts
    159
    Thank Post
    7
    Thanked 3 Times in 3 Posts
    Rep Power
    17
    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
    placky's Avatar
    Join Date
    Feb 2008
    Location
    N wales
    Posts
    27
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks for the help Binky and m2d2!

    A reinstall of the Scripting Host fixed it

    Regards

    Gareth

SHARE:
+ Post New Thread

Similar Threads

  1. VBScript / SQL Server
    By Gatt in forum Scripts
    Replies: 7
    Last Post: 23rd September 2011, 03:21 PM
  2. FileSystemObject Folder why permission denied
    By NetworkGeezer in forum Coding
    Replies: 16
    Last Post: 2nd September 2011, 05:10 PM
  3. VBScript IDE + Debugger
    By Geoff in forum Scripts
    Replies: 4
    Last Post: 13th September 2007, 08:56 PM
  4. another VBScript question!
    By StewartKnight in forum Coding
    Replies: 4
    Last Post: 3rd May 2007, 05:41 PM
  5. VBScript
    By StewartKnight in forum Coding
    Replies: 5
    Last Post: 1st May 2007, 11:04 AM

Thread Information

Users Browsing this Thread

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

Posting Permissions

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