locked
Event log archive script in progress RRS feed

  • Question

  • Below is the script followed by the error output... We do not want to use winzip (wzzip) we want to use the .zip program built within the Microsoft 2012 R2 OS yet I can not find a program name, switches, etc for this... any help would be great. Also What should I use besides "$output_path"

    cd $output_path
    $files_to_zip = dir "C:\Windows\System32\winevt\Logs\Archive-Security-*"
    $zip_file_name = $output_path + $ENV:COMPUTERNAME + "_evts_" + $date_stamp + ".zip"
    wzzip -whs -p -r -m $zip_file_name $files_to_zip

    Monday, January 11, 2016 5:41 PM

Answers

  • I figured out how to fix it... Realizing the CD is an alias for the cmdlet set-location I set the location manually instead of trying to use a variable.

    Monday, January 11, 2016 8:08 PM

All replies

  • There is no zip program built into any version of Windows.

    You can look in the Gallery for scritps that can zip up files in various ways.

    https://gallery.technet.microsoft.com/


    \_(ツ)_/

    Monday, January 11, 2016 5:49 PM
  • If that is the case then how does windows OS offer the ability to compress a file/ folder or create a compressed folder?

    That is what we want to use in the script, unfortunately I can not find a Microsoft reference in which that is scripted. 

    Monday, January 11, 2016 6:32 PM
  • It uses the shell.  The shell requires event programming to compress a file. This is only available to compiled programs.  There is NO user accessible ZIP program except from the shell (File Explorer)

    If you are an adept programmer you can use the et FrameWork.

    Look in the Gallery for prewritten solutions.


    \_(ツ)_/

    Monday, January 11, 2016 6:35 PM
  • If that is the case then how does windows OS offer the ability to compress a file/ folder or create a compressed folder?

    That is what we want to use in the script, unfortunately I can not find a Microsoft reference in which that is scripted. 

    The answer to that is that it is a GUI-only object that is not designed to be scripted.

    -- Bill Stewart [Bill_Stewart]

    Monday, January 11, 2016 6:38 PM
  • What should I use besides "$output_path" that was the other error I ran into.
    Monday, January 11, 2016 6:53 PM
  • The code you posted doesn't set that variable.


    -- Bill Stewart [Bill_Stewart]

    Monday, January 11, 2016 6:58 PM
  • What variable or structure should I use to make it work?
    Monday, January 11, 2016 7:49 PM
  • Unfortunately I'm not able to guess at what you want to do. As we mentioned in the other question you asked, we would recommend that you create a test directory and experiment with the commands until you get the result you need. We can't do that for you in a forum. If you're not able to get what you need done, then you will probably need to hire a consultant with more experience to complete the task for you.


    -- Bill Stewart [Bill_Stewart]

    Monday, January 11, 2016 8:04 PM
  • I figured out how to fix it... Realizing the CD is an alias for the cmdlet set-location I set the location manually instead of trying to use a variable.

    Monday, January 11, 2016 8:08 PM