I have a simple powershell script that runs from Task Scheduler on my Win'2008R2 system which basically just runs the following command:

gsutil -o GSUtil:parallel_composite_upload_component_size=0 cp -L C:\logs\log1.txt C:\archive\*.zip gs://temp

I'm using Start-Transcript to record the output to the results.log file. The problem is that when it's uploading the zip files to gcp it keeps recording the progress on multiple rows after every 64KB during the upload:

Resuming upload for file://E:\db\db1.zip
Uploading   gs://temp/db1.zip:             0 B/1.20 GiB
Uploading   gs://temp/db1.zip:             98.75 MiB/1.20
Uploading   gs://temp/db1.zip:             98.81 MiB/1.20
...and keeps repeating this until it uploads the entire 1.20 GB.

Since the results.log file is then being emailed to a group of people I don't need them to see all this junk. Showing just one line of it with the final file size would suffice.

When I run the command or script from a windows command prompt (or from native powershell) using: powershell.exe -file c:\scripts\upload.ps1 then it works as expected showing the progress on a single line:

Resuming upload for file://E:\db\db1.zip
Uploading   gs://temp/db1.zip:             1.20 GiB/1.20 GiB

Before, when I was running the same command without the '-o GSUtil:parallel_composite_upload_component_size=0' parameter it was showing me the same long output but once I added this to gsutil I thought it was fine since it doesn't repeat the progress anymore on a bunch of lines in the PS command prompt. So it only happens when I run the script from Task Scheduler.

Any ideas why this is happening and how can I get around this?

1 Answers

mhouglum On Best Solutions

There's an open feature request in the gsutil repository, issue #481, to disable the progress spinner when the output is directed to something that isn't an interactive terminal.