Help request!

Hello All,

I am new to powershell sripting, required little help solving a requirement, Can anyone help me with a powershell script in getting the latest build artifact from bamboo server & download the same?

Thanks a lot!

Can anyone guide me with the below error,

Curl : Chunked encoding must be set via the SendChunked property.
Parameter name: value
At C:\test.ps1:12 char:1

  • Curl -Uri $artifacts -WebSession $TeamCitySession -TransferEncoding “chunked” -O …
  •   + CategoryInfo          : NotSpecified: (:) [Invoke-WebRequest], ArgumentException
      + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
    
    

How to set the sendChunked property ??

Can’t say what that could be related to, but in powershell the “curl” command is actually an alias for “Invoke-WebRequest”. So you can run this to get the documentation for that command. There might be something in there that helps you out.

get-help Invoke-WebRequest

Thanks Jeremy for your kind response.

I was getting outofmemory error while downloading a big artifact file(3GB) from bamboo.I am trying to resolve the outofmemory
error.

Invoke-WebRequest : Exception of type ‘System.OutOfMemoryException’ was thrown.
At C:\test.ps1:7 char:1

  • Invoke-WebRequest -Uri $artifacts -WebSession $TeamCitySession -OutFile "C:\tem …
  •   + CategoryInfo          : NotSpecified: (:) [Invoke-WebRequest], OutOfMemoryException
      + FullyQualifiedErrorId : System.OutOfMemoryException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
    
    

tried setting powershell memory to higher value set-item wsman:localhost\shell\maxmemorypershellmb 1000000 . however, it is not helping me.

Can you or anyone in the forum can suggest me any workaround to it. It will make life easy, help much appreciated.

You want to ensure that you are using the right tool for the right job.

For example, see these to references:
3 ways to download files with PowerShell
Weekend Scripter: Use PowerShell and BITS to Simplify Downloading Large Files - Scripting Blog