/build/static/layout/Breadcrumb_cap_w.png

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?


0 Comments   [ + ] Show comments

Answers (3)

Answer Summary:
Posted by: dugullett 11 years ago
Red Belt
4

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 11 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 11 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 11 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 11 years ago
Posted by: jagadeish 11 years ago
Red Belt
2

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

Posted by: piyushnasa 11 years ago
Red Belt
0

You can use a Powershell script as well to copy a file.

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ