I’m trying to complete this: I need to delete
documents & settingsusernamelocal settingstemp
folder at computer startup and I’m implementing this via GPO.
My peice of code is:
set oFS = CreateObject(“Scripting.FileSystemObject”)
set oWSH = CreateObject(“WScript.Shell”)
‘gets the last logged on user
sLastUser = oWSH.RegRead (“HKLMSoftwareMicrosoftWindows NTCurrentVersionWinlogonDefaultUserName”)
sTempPath = “c:Documents and Settings” & sLastUser & “Local SettingsTemp”
‘delete entire folder
Everything works fine, except when inside TEMP folder there are Read-Only files.
In that case I receive an Access Denied during computer startup.
Is there a way to force deletion for RO files (or anso for locked files) so that deletion is surely completed?