Author Posts

November 1, 2017 at 12:37 pm

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!

November 1, 2017 at 1:08 pm

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 ??

November 1, 2017 at 1:18 pm

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

November 1, 2017 at 2:01 pm

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.

November 1, 2017 at 4:38 pm

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

For example, see these to references:
'blog.jourdant.me/post/3-ways-to-download-files-with-powershell'
'blogs.technet.microsoft.com/heyscriptingguy/2012/08/25/weekend-scripter-use-powershell-and-bits-to-simplify-downloading-large-files'