title: delete the self folder once execution completed
body: <p>I was able to delete the script once the execution completed.</p>
  
  <pre><code>function Delete() {
      $Invocation = (Get-Variable MyInvocation -Scope 1).Value
      $Path =  $Invocation.MyCommand.Path 
      Write-Host $Path 
      Remove-Item $Path
              }       
  Delete  
  </code></pre>
  
  <p>But am unable to delete the entire folder and subfolder from where the script is running. Is there any way to get around this which works on both powershell2.0 and 3.0?</p>