Kaseya Community

Zipping Files on remote system from cmd line

  • I'm trying to zip up some files on a remote computer that I could then use the Get File to pull this over to my server. I'm using 7z as the zip tool. I've tested the ability to upload the 2 files that I have 7z.exe and 7z.dll to the remote directory with no issues.

    Here is the script that I am trying to run:

    Script Name: Gather Files
    Script Description: Gather Files

    IF True
    THEN
    Get Variable
    Parameter 1 : 10
    Parameter 2 :
    Parameter 3 : AgentTemp
    OS Type : 0
    Write File
    Parameter 1 : #AgentTemp#\7z.dll
    Parameter 2 : VSASharedFiles\7z\7z.dll
    OS Type : 0
    Write File
    Parameter 1 : #AgentTemp#\7z.exe
    Parameter 2 : VSASharedFiles\7z\7z.exe
    OS Type : 0
    Execute Shell Command
    Parameter 1 : #AgentTemp#\7z.exe a files.zip c:\dir_to_zip
    Parameter 2 : 0
    OS Type : 0
    ELSE

    Nothing happens? No zip file in the temp directory. Locally on that computer if I click start, run then type in c:\temp\7z.exe a filename.zip c:\dir_to_zip it creates the filename.zip in my temp directory with the contents of the c:\dir_to_zip directory.

    Am I missing something here? I can't see what I am doing wrong. Thanks in advance for any suggestions.

    Thanks
    Nathan

    Legacy Forum Name: Zipping Files on remote system from cmd line,
    Legacy Posted By Username: n8dawg
  • This was a command i used in a vbscript
    StrZip = Tempdir &"\treesize\7z.exe" & " a " & Tempdir &"\treesize\report\diskreport.zip " & Tempdir &"\treesize\report\*.*"

    Not sure if you have to specify the path to files.zip and also c:\dir_to_zip\*.*

    Just a thought might not be the case.

    Michael

    Legacy Forum Name: How-To,
    Legacy Posted By Username: mmartin
  • Try using "Execute File" rather than "Execute Shell Command."

    Also use the -tzip argument to specify that you want to use zip format, not 7z format.

    And last but not least, make sure you got the command-line version of 7z.exe ...

    Legacy Forum Name: How-To,
    Legacy Posted By Username: Lmhansen