ConvertFrom-GZipString.psm1
<# .SYNOPSIS Decompresses a Gzipped and decodes a Base64-encoded string back to its original content .DESCRIPTION Decompresses a Gzipped and decodes a Base64-encoded string back to its original content .NOTES ┌─┐┬─┐┌─┐┌┬┐┌─┐┬─┐┌─┐ ┌┬┐┌─┐┌─┐┬ ┬┌┐┌┌─┐┬ ┌─┐┌─┐┬┌─┐┌─┐ ┬ ┬ ┌─┐ ├─┘├┬┘│ │ │ ├┤ ├┬┘├─┤ │ ├┤ │ ├─┤││││ ││ │ ││ ┬│├┤ └─┐ │ │ │ ┴ ┴└─└─┘ ┴ └─┘┴└─┴ ┴ ┴ └─┘└─┘┴ ┴┘└┘└─┘┴─┘└─┘└─┘┴└─┘└─┘ ┴─┘┴─┘└─┘ # Copyright (c) Protera Technologies LLC. All rights reserved. # Author Cody.Diehl|Protera Technologies LLC Email c.diehl@protera.com Create 05-20-2022 13:31:20 Modify 05-26-2022 07:54:40 Version v0.9.0 05-20-2022 - initial function creation for gzip decompress base64 decoding - Cody Diehl 05-26-2022 - Configured as a Module to post on PowerShell Gallery for Azure Automation - Cody Diehl #> Function ConvertFrom-GZipString () { [CmdletBinding()] Param( [Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelinebyPropertyName = $True)] [String[]]$String ) Process { $String | ForEach-Object { $compressedBytes = [System.Convert]::FromBase64String($_) $ms = New-Object System.IO.MemoryStream; $ms.write($compressedBytes, 0, $compressedBytes.Length); $ms.Seek(0, 0) | Out-Null $cs = New-Object System.IO.Compression.GZipStream($ms, [System.IO.Compression.CompressionMode]::Decompress) $sr = New-Object System.IO.StreamReader($cs); $sr.ReadToEnd() } } } Export-ModuleMember -Function ConvertFrom-GZipString |