Quantcast
Channel: Spiceworks Community
Viewing all articles
Browse latest Browse all 7

Powershell, 7-zip, Password protected zip

$
0
0

I took it a step further and "pimped my script"

#define variables
$process = "c:\Program Files (x86)\7-Zip\7z.exe"
$destinationFile = "c:\temp\testfile.zip"
$sourceFile = "c:\temp\*.xls"
$password = "password123"

#define functions
function balloonPopup($message){
[system.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | Out-Null
$balloon = New-Object System.Windows.Forms.NotifyIcon
$path = Get-Process -id $pid | Select-Object -ExpandProperty Path
$icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)
$balloon.Icon = $icon
$balloon.BalloonTipIcon = 'Info'
$balloon.BalloonTipText = $message
$balloon.BalloonTipTitle = 'Done'
$balloon.Visible = $true
$balloon.ShowBalloonTip(10000)
}

#script body
$p = Start-Process $process -ArgumentList "a $destinationFile $sourceFile -p$password" -Wait -PassThru

...


Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>