The snippet below checks for a flag file, and works fine when I'm logged in as an admin on XP, but errors on the Set objFile = objFSO.CreateTextFile("C:\PTRMIG_FLG_.txt") line when logged in as a Power
User or less. It returns a Permission Denied error. How can I create a file on the root of a machines C: drive or the root of the currently logged on users profile?
This runs as a logon script.
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Check for flag file and stop script if it exists
If objFSO.FileExists("C:\PTRMIG_FLG_.txt") Then
WScript.Quit
Else
Set objFile = objFSO.CreateTextFile("C:\PTRMIG_FLG_.txt")
End If
Thanks for any help or suggestions!
User or less. It returns a Permission Denied error. How can I create a file on the root of a machines C: drive or the root of the currently logged on users profile?
This runs as a logon script.
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Check for flag file and stop script if it exists
If objFSO.FileExists("C:\PTRMIG_FLG_.txt") Then
WScript.Quit
Else
Set objFile = objFSO.CreateTextFile("C:\PTRMIG_FLG_.txt")
End If
Thanks for any help or suggestions!