Hi,
I am relatively new to VBScripting and have pieced together a script that works, but need some fine tuning. As a requirement if either the attribute doesn't reset or the file fails to copy an error code must be generated. I do not know how to do this and need some assistance. Here is an example of my code. Thanks
I am relatively new to VBScripting and have pieced together a script that works, but need some fine tuning. As a requirement if either the attribute doesn't reset or the file fails to copy an error code must be generated. I do not know how to do this and need some assistance. Here is an example of my code. Thanks
Code:
Option Explicit
Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objShell: Set objShell = CreateObject("WScript.Shell")
Dim strPath: strPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")
Dim objEnv: Set objEnv = objShell.Environment("Process")
Dim strCache, strMe, strCMD, objFile
strCache = objEnv.Item("WINDIR") & "\Installer\{AFA5AA71-989F-42E1-B3AF-BC6E135617F1}\"
strMe = Left(Replace(WScript.ScriptFullName,WScript.ScriptName,""), Len(Replace(WScript.ScriptFullName,WScript.ScriptName,""))-1)
strCMD = strMe & "\CiscoIPCommunicatorSetup.MST" & " "
If objFSO.FolderExists(strCache) = True Then
Set objFile = objFSO.GetFile(strCache & "CiscoIPCommunicatorSetup.MST")
objFile.Attributes = 0
If Err.Number <> 0 Then CleanEnv -1
objFSO.CopyFile strCMD, strCache, True
If Err.Number <> 0 Then CleanEnv -2
end if
CleanEnv 0
'----------------------------------------------------
Sub CleanEnv(intExitCode)
On Error Resume Next
Set objFSO = Nothing
Set objEnv = Nothing
Set objShell = Nothing
WScript.Quit intExitCode
End Sub