1

I am using Powershell to upload PDF files into a blob storage account using:

Set-AzStorageBlobContent -File <local path> `
  -Container "<container name>" `
  -Blob <blob name> `
  -Context <storage account with key>`
  -StandardBlobTier Cool `
  -Force

This works fine, I have no problems with the code, files upload without issue. However, the return I get from doing this is an enormous amount of text, it looks like: enter image description here

This is fine if I am doing a few files, but I am doing hundreds of thousands. This ends up using up way too much memory when I run it, as a result of the amount of information returned. How do I stop the massive amount of return info from writing to the blob?

I have tried:

[void] (Set-AzStorageBlobContent ...

And

$ret = Set-AzStorageBlobContent ...

Both still return the huge return values.

blobbles
  • 251
  • 2
  • 10

1 Answers1

2

You can use Out-Null:

The Out-Null cmdlet sends its output to NULL, in effect, removing it from the pipeline and preventing the output to be displayed at the screen.

Get-ChildItem | Out-Null
Markus Meyer
  • 3,327
  • 10
  • 22
  • 35
  • 2
    Note that in PoweShell Core this is perfectly fine but is very inefficient in Windows PowerShell. `$null =` or `> $null` are better approaches – Santiago Squarzon Jun 28 '22 at 03:50