dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Can not schedule Save-DbaKBUpdate due to Start-BitsTransfer dependency on logged in user

Open steverezhener opened this issue 2 years ago • 8 comments

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

Start-BitsTransfer : The operation being requested was not performed because the user has not logged on to the network. The specified service does not exist. (Exception from HRESULT: 0x800704DD) At line:113230 char:17 + Start-BitsTransfer -Source $link -Destination $file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Start-BitsTransfer], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.BackgroundIntelligentTransfer.Mana gement.NewBitsTransferCommand. Process Exit Code 0. The step succeeded.

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference

Please confirm that you are running the most recent version of dbatools

2.0.4

Other details or mentions

No response

What PowerShell host was used when producing this error

Windows PowerShell ISE (powershell_ise.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.14393.5582
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.5582
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

N/A

.NET Framework Version

.NET Framework 4.7.4051.0

steverezhener avatar Aug 22 '23 15:08 steverezhener

how much time is a KB going to need to be downloaded fully ? Not sure what's your environment here .... are you scheduling a job to download each time one or two KBs ?

niphlod avatar Aug 22 '23 15:08 niphlod

It is not likely dependency on "logged in user" but that the user can create a profile. If you are using service account or such that is policy blocked with the "Allow local login" (can't recall full name of that policy), that prevents it from creating a profile locally on the device.

This isn't really a bug just the way BitsTransfer service works.

wsmelton avatar Aug 22 '23 15:08 wsmelton

It's scheduled in a job, so time is not a constraint. The idea is to automate the download of the latest and greatest. It's a combination of: Test-DbaBuild Get-DbaBuild Get-DbaKbUpdate Save-DbaKbUpdate

steverezhener avatar Aug 22 '23 15:08 steverezhener

someone is reinventing sccm with dbatools ;-)

niphlod avatar Aug 22 '23 16:08 niphlod

wsmelton, checked the group policy. that was not the problem. you are correct, but ... it's indirectly a dbatools problem since the bitstransfer implementation has a limitation. unfortunately, bitstransfer can not be automated, so it can only be used manually. can we add an option/fork to use IWR/invokewebrequest instead of bitstransfer?

steverezhener avatar Aug 22 '23 22:08 steverezhener

niphlod, SCCM is a bit of a tank for my bicycle needs.

steverezhener avatar Aug 22 '23 22:08 steverezhener

BTW, I got it working without using bitstransfer. Still using getdbakbupdate to get a link, but instead of savedbakbupdate which is using bitstransfer, i'm using invokewebrequest. Slow (close to 20 minutes for less than 1GB file), but no babysitter is required.

steverezhener avatar Aug 22 '23 22:08 steverezhener

That's interesting because Copy-DbaDatabase is using BitsTransfer to move files and is one of our most used commands in automation (non-interactive). Folks use that in SQL Agent jobs and scheduled tasks.

wsmelton avatar Aug 23 '23 00:08 wsmelton