I have a powershell script where I perform a upload then I must do a RESTful request about the file I just uploaded. Right now it works great as a non-asynchronous method
Start-BitsTransfer -Source $fullPath -Destination "https://www.example.com/bitsupload/$Guid.$SourceFile" -Credential $Credential -TransferType Upload
$web = New-Object Net.WebClient
$web.DownloadString("https://www.example.com/newbitspost/?filename=$Guid.$SourceFile&filedescription=$Description&Friendlyname=$SourceFile")
However I would like to run this in the background so the end user can close the window (more importantly, and my final goal, logoff) and it will still be transferring.
I know I can add -Asynchronous
to my Start-BitsTransfer
but I can not figure out how to get that GET request performed after the transfer completes.
Thanks to the false positive Duplicate question link (The other question's answer never actually solves the problem it just shows how to manually execute something afterwards) My question boils down to: How do I duplicate the functionality of /SetNotifyCmdLine
from the deprecated BitsAdmin program.