title: Unzipping a .7z file in Azure Automation
body: <p>I can successfully unzip a .7z in Powershell ISE (workflow), however when I use the same code in an Azure runbook, nothing happens:</p>
  
  <pre><code>workflow Unzip-File
  {
      Param([Parameter(mandatory=$true)][String]$zipFileSource,
            [Parameter(mandatory=$true)][String]$destinationFolder,
            [Parameter(mandatory=$true)][String]$password,
            [Parameter(mandatory=$true)][String]$pathTo7zipExe)
  
      InlineScript
      {
          Write-Output "${using:zipFileSource} exists? - $(Test-Path ${using:zipFileSource})"
          Write-Output "${using:destinationFolder} exists? - $(Test-Path ${using:destinationFolder})"
          Write-Output "${using:pathTo7zipExe} exists? - $(Test-Path ${using:pathTo7zipExe})"
          $passwordSwitch = "-p" #this is needed because otherwise the password is literally $password rather than the string stored in that variable.
          $destinationDirSwitch = "-o"
          &amp; ${using:pathTo7zipExe} x ${using:zipFileSource}$destinationDirSwitch${using:destinationFolder}$passwordSwitch${using:password} -y #-y means if prompted for yes/no, choose yes automatically.
  
          $fileName = "test.txt"
          $destinationPath = [System.IO.Path]::Combine(${using:destinationFolder}, $fileName)
          Write-Output "$destinationPath exists? - $(Test-Path $destinationPath)"
      }
  }
  </code></pre>
  
  <p>Calling the runbook:</p>
  
  <pre><code>Unzip-File `
          -destinationFolder C:\Temp `
          -Password "ThePassword" `
          -pathTo7zipExe 'C:\Temp\7za.exe' `
          -zipFileSource 'C:\Temp\test.7z'
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>C:\Temp\test.7z exists? - True
  c:\temp exists? - True
  C:\Temp\7za.exe exists? - True
  c:\temp\test.txt exists? - False
  </code></pre>
  
  <p>As you can see the file contained within the .7z (test.txt) is not being extracted.</p>
  
  <p>The files are on the Automation host's C:\Temp folder (I downloaded them there from blob storage). I have double checked that the password is the same one that was used to zip the .7z file. The test.7z file contains one file called test.txt. 7za.exe is the portable exe for 7zip and worked fine when run in Powershell ISE.</p>