How to replace a file with scripting on K1000
After installation of Secure Checkpoint client i have to replace the file "user.c" with another one i have on a share map on a server on a domain.
How can i replace this file in K1000 with a scripting?
Answers (3)
Something like this would work. You can also use reg keys for your verify command. This ensures that the script will only run on the machine if "dummy.txt" does not exist. The remediation would be to copy that file, plus your user file.
Make sure to upload both files as dependencies.
Comments:
-
thank you very much for your replay - diana_achim 12 years ago
-
I'm not sure how you are currently installing the software, or if you can create a transform. You can always include you "msiexec /i software.msi /q" at the top of this batch. That way you will not have multiple scripts for one piece of software. - dugullett 12 years ago
-
I forgot to mension that the file that needs to be replaced is on a share on a computer in a domain and the place where the file needs to be copied is on a tablet in workgroup so i need also the account credential to access the share map. - diana_achim 12 years ago
-
You can use the net use command to map a share. If you do upload the file as a dependency to the Kbox then it is basically the same thing. I would copy the file from the share and paste somewhere local to your machine. From there upload it as a dependency.
The tablet being in a workgroup will not matter as long as it has the Kace agent. - dugullett 12 years ago
You can write a VBScript which will perform the following task to do this activity
1. Delete the existing old user.c file
2. Copy the new user.c file
Option Explicit
'On Error Resume Next
Dim objFSO, FileName, SourceLocation, DestLocation
Const OverwriteExisting = True
SourceLocation = "C:\Source"
DestLocation = "C:\Dest"
FileName = "user.c"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists (SourceLocation & "\" & FileName) Then
If objFSO.FolderExists (DestLocation) Then
If objFSO.FileExists (DestLocation & "\" & FileName) Then
objFSO.DeleteFile(DestLocation & "\" & FileName)
objFSO.CopyFile SourceLocation & "\" & FileName , DestLocation & "\", OverwriteExisting
End If
End If
End If
Set objFSO = Nothing
WScript.Quit