Hey all,
I am looking for a script to create a zip from a single file on PSv4
I have been looking and not found any that make since. I have a script that created a extract from a database that is over 300mb and I want to automate compressing it and emailing it. I have all the other parts working except the zip.
It all depends on what version of PoSH you are on.
Prior to v5 you had to us .Net, v5 and higher has cmdlets for this.
# Get parameters, examples, full and Online help for a cmdlet or function
# Get a list of all functions
Get-Command -CommandType Function | Format-Table -AutoSize
# Get a list of all commandlets
Get-Command -CommandType Cmdlet | Format-Table -AutoSize
# Get a list of all functions for the specified name
Get-Command -Name '*archive*' -CommandType Function | Format-Table -AutoSize
CommandType Name Version Source
----------- ---- ------- ------
Function Compress-Archive 1.0.1.0 Microsoft.PowerShell.Archive
Function Expand-Archive 1.0.1.0 Microsoft.PowerShell.Archive
# Get a list of all commandlets for the specified name
Get-Command -Name '*archive**' -CommandType Cmdlet | Format-Table -AutoSize
# get function / cmdlet details
(Get-Command -Name Compress-Archive).Parameters
Get-help -Name Compress-Archive -Examples
Get-help -Name Compress-Archive -Full
Get-help -Name Compress-Archive -Online
Get-Help about_*
Get-Help about_Functions
# Find all cmdlets / functions with a target parameter
Get-Help * -Parameter Append
Get-Command -CommandType cmdlet `
| Where-Object { $_.parameters.keys -match 'credential'} `
| Format-Wide name -AutoSize
# All Help topics locations
explorer "$pshome\$($Host.CurrentCulture.Name)"
Other pre-built stuff to use…
Use PowerShell to Create ZIP Archive of Folder
'blogs.technet.microsoft.com/heyscriptingguy/2015/03/09/use-powershell-to-create-zip-archive-of-folder'
7Zip4PowerShell 1.8.0
Powershell module for creating and extracting 7-Zip archives
'powershellgallery.com/packages/7Zip4Powershell/1.8.0'