When running start-bitstransfer in a script I'm trying to apply pester to... it doesn't seem to work... I just tried downloading some random http page (while preparing to do some tropico 5 ;) ... to the pester testdrive, but this doesnt work... do .net things not work with pester or such ?
set-content "testdrive:\bla.txt" -value "bla"
Start-BitsTransfer -source "http://www.tropicostrategy.com/p/blog-page.html" -destination 'testdrive:\' -Description "Downloading test"
Get-ChildItem 'TestDrive:\' | out-file c:\temp\b.txt
output:
Describing get-wallhavens
[-] downloads a file 591ms
ArgumentException: Value does not fall within the expected range.
ArgumentException: An incorrect value is specified in the Source parameter or in the Destination parameter. Verify that the directory and file names in the Source and Destination parameters are correct.
at <ScriptBlock>, D:\stack\Projects\Personal\wallchange\download-wallpaper.Tests.ps1: line 7
The documentation on GitHub indicates that you need to use a variable that holds the real location of the temporary storage:
Working with .NET Objects
When working directly with .NET objects, it's not possible to use the convenient
TestDrive:\
PSDrive. Instead you need to use the$TestDrive
variable which holds the actual path in a format that .NET understands. For example instead of usingTestDrive:\somefile.txt
use$TestDrive\somefile.txt
instead.