Why doesn't this work?

M

Mike

Hi -

I am trying to get this piece of script to work without any success. I am
running this on W2K w/SP4 and IIS 5.0. I am using Windows Integrated
Authentication and logging on as a Domain Admin.

' Create File System Object
Set objFiles = Server.CreateObject("Scripting.FileSystemObject")

' Check for duplicate folder name
If objFiles.FolderExists(strHomeDirectory)

Then WScript.Echo "A home folder " & strHomeDirectory & " already exists. A
new home folder will need to be created manually."

Else

'Create the User HomeDirectory - This works!
objFiles.CreateFolder(strHomeDirectory)

ChangeFolderSettings("AUserFolder")

Sub ChangeFolderSettings(strLoginID)

Dim cmdCacls
Dim objWsShell
Dim objWsRun

cmdCacls = "cmd /c echo y| CACLS.EXE \\" & strServer & "\" &
strStudentGradYear & "\" & strInit & "\" & strLoginID & " /e /g " &
strLoginID & ":C"
Set objWsShell = Server.CreateObject("WScript.Shell")
' IIS does not like this
Set objWsRun = objWsShell.run(cmdCacls, 0, True)

Set objWsShell = nothing
Set objWsRun = nothing

End Sub

End If

At the Set objWsRun = objWsShell.run(cmdCacls, 0, True) line IIS returns an
error stating:

Microsoft VBScript runtime (0x800A01A8)
Object required: 'objWsShell.run(...)'

The folder does get created sucessfully.

Any help on this or other methods of setting folder permissions within an
ASP page would be greatly appreciated.

Thanks!!!

Mike
 
B

Boris Nikolaevich

IIRC, and I haven't checked this, the run method returns a number indicating
success (0) or error (any other value). Since the data type Long Integer is
obviously NOT an object, you're getting the error because you're trying to
"Set objWsRun = ... " instead of just letting "lngResult = ..."

HTH, someone correct me if I'm wrong...

--Boris
 
M

Mike

Thank you Boris.

You were right.

Boris Nikolaevich said:
IIRC, and I haven't checked this, the run method returns a number indicating
success (0) or error (any other value). Since the data type Long Integer is
obviously NOT an object, you're getting the error because you're trying to
"Set objWsRun = ... " instead of just letting "lngResult = ..."

HTH, someone correct me if I'm wrong...

--Boris

exists. returns
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top