On Error Resume Next
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set WshShell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
'Variable Declarations
ProgramFiles = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")
SystemDrive = WshShell.ExpandEnvironmentStrings("%SystemDrive%")
SystemRoot = WshShell.ExpandEnvironmentStrings("%SystemRoot%")
AllUsersProfile = WshShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
ScriptFullName = WScript.ScriptFullName
ScriptName = WScript.ScriptName
InstallDir = Left(ScriptFullName, Len(ScriptFullName)-Len(ScriptName)-1) & "\"
WshShell.CurrentDirectory = InstallDir
ManagedMarker=InstallDir & "\Success.txt"
CfgXML="Configuration.xml"
CfgXMLbkp="configuration1.old"
CfgXMLPath="\Application Data\Cisco\Cisco Secure Services Client\system\"
'Create Logfile
Set InstLogFile = fso.CreateTextFile(ScriptFullName & ".Log",True)
InstLogFile.WriteLine Now() & " Starting Installation of """ & ScriptFullName & """."
If fso.fileexists(AllUsersProfile & CfgXMLPath & CfgXML) Then
'archive file
Set objFile = FSO.GetFile(AllUsersProfile & CfgXMLPath & CfgXML)
If objFile.Attributes AND 1 Then
objFile.Attributes = objFile.Attributes = 0
End If
InstLogFile.WriteLine Now() & " Found 'Configuration.xml' in Allusers path. Backing it up."
fso.CopyFile AllUsersProfile & CfgXMLPath & CfgXML, AllUsersProfile & CfgXMLPath & CfgXMLbkp
'copy new file
InstLogFile.WriteLine Now() & " Replacing/Inserting new 'Configuration.xml'."
fso.deletefile AllUsersProfile & CfgXMLPath & cfgXML
fso.copyfile InstallDir & cfgxml, AllUsersProfile & CfgXMLPath & cfgXML
If objFile.Attributes AND 0 Then
objFile.Attributes = objFile.Attributes = 1
End If
Else
InstLogFile.WriteLine Now() & " 'Configuration.xml' not found. Assuming CSSC not installed."
End If
InstLogFile.writeline now() & " Installation of """ & ScriptFullName & """ is Finished."
InstLogFile.Close()
Set InstLogFile = Nothing
Set FSO = Nothing
Set WshShell = Nothing
|