Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')
$SO=SetOption('WrapAtEOL','On')
Dim $ProfilesDirectory, $Profiles
If InGroup(@WKSTA+'\'+SidToName('S-1-5-32-544'))
;User has Admin rights so delete file from all profiles
$ProfilesDirectory = ExpandEnvironmentVars(ReadValue('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList','ProfilesDirectory'))
$Profiles = Dir ($ProfilesDirectory)
While $Profiles <> '' And Len($ProfilesDirectory)>15
If $Profiles
If GetFileAttr($ProfilesDirectory+'\'+$Profiles+'\Local Settings\Temp') & 16
If Len($ProfilesDirectory+'\'+$Profiles)>25
If GetFileAttr($ProfilesDirectory+'\'+$Profiles+'\Local Settings\Temp') & 16
;DEL ($ProfilesDirectory+'\'+$Profiles+'\Local Settings\Temp','*.TMP')
;Untested code but gives the idea
EndIf
EndIf
EndIf
EndIf
$Profiles = Dir ()
Loop
Else
;User does not have Admin rights so only clean the users file
Dim $CurrentUserTemp
$CurrentUserTemp = ExpandEnvironmentVars(ReadValue('HKCU\Environment','TEMP'))
;Check and verify the path length is good and that the location exists
If Len($CurrentUserTemp)>15
If GetFileAttr($CurrentUserTemp) & 16
;DEL ($CurrentUserTemp,'*.TMP')
;Untested code but gives the idea
EndIf
EndIf
EndIf
Exit @ERROR