Hello,
I am writing a script to delete user Profile Directory Trees and User Data directory Trees. I am getting error 80070002 "The System Cannot Find The File Specified". This is what my code looks like:
objFSO is an instance of the WScript.FileSystemObject object
objShell is an instance of the Wscript.Shell object
strUserPath is the full path including drive letter of the directory I want to delete
I'm running the script interactively as the domain admin on the server itself and, frustratingly, I can happily carry out the above shell command manually, just not from this script...
You might think that, seeing as the FSO is happy that the folder exists, getting the error I'm getting shouldn't be possible...
I thought this might be a permissions related problem and that the .Shell object just wasn't returning the right error, so I've given the directory I want to delete Full Control to Everybody, but it makes no difference.
If anybody has any ideas, I'd be very happy to hear them.
Thanks,
Paul
I am writing a script to delete user Profile Directory Trees and User Data directory Trees. I am getting error 80070002 "The System Cannot Find The File Specified". This is what my code looks like:
Code:
If objFSO.FolderExists(strUserPath) Then
strCmd = "rd /s /q " & strUserPath
iRC = objShell.Run(strCmd,0,TRUE)
End If
objFSO is an instance of the WScript.FileSystemObject object
objShell is an instance of the Wscript.Shell object
strUserPath is the full path including drive letter of the directory I want to delete
I'm running the script interactively as the domain admin on the server itself and, frustratingly, I can happily carry out the above shell command manually, just not from this script...
You might think that, seeing as the FSO is happy that the folder exists, getting the error I'm getting shouldn't be possible...
I thought this might be a permissions related problem and that the .Shell object just wasn't returning the right error, so I've given the directory I want to delete Full Control to Everybody, but it makes no difference.
If anybody has any ideas, I'd be very happy to hear them.
Thanks,
Paul