When you are using IIS, the permissions granted to
IUSR_machinename
is important for such scenarios.
If you do not have write permission to the C drive for
IUSR_machinename
, an error will occur in the above script.
Same thing discussed/explained here:
Using the FileSystemObject to Write to Text Files [
^]
In case, the requests are impersonated, then you need to make sure that the user impersonated has the security permissions.