I have this script setup to delete an unattend file in windows after I sysprep a pc. I want the script to delete the file, and it does. BUT if the file isn't there for whatever reason, I want the script to skip the delete process and end without an error.
Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile("C:\Windows\System32\sysprep\unattend.xml")
Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile("C:\Windows\Panther\unattend.xml")
Dim objFSO
'Create a File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Delete the currently executing script
objFSO.DeleteFile WScript.ScriptFullName
Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile("C:\Windows\System32\sysprep\unattend.xml")
Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile("C:\Windows\Panther\unattend.xml")
Dim objFSO
'Create a File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Delete the currently executing script
objFSO.DeleteFile WScript.ScriptFullName