Jump to content

VBScript and 'Scripting.filesystemobject'


Recommended Posts

Posted

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.

 

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!

Posted

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...