SOLVED

BITS

Copper Contributor

Do you have any scripts/guidance of clearing down bits with a ci for example on jobs that have stalled, errored etc.

 

Thanks

 

In the end I ended up borrowing bits of anders rodland excellent script from his configmgr client health script https://www.andersrodland.com/ 

 

so I ended up with a very rough ci script for sccm to clear down bits I'm sure it can be improved upon but it does the job for me.

 

Bits Error detection CI

$Errors = ""
$Errors = Get-BitsTransfer -AllUsers | Where-Object { ($_.JobState -like "TransientError") -or ($_.JobState -like "Transient_Error") -or ($_.JobState -like "Error") }
if ($Errors -eq "") {

}
Else
{
return "False"
}
return "True"


Remediation

$Errors = ""
$Errors = Get-BitsTransfer -AllUsers | Where-Object { ($_.JobState -like "TransientError") -or ($_.JobState -like "Transient_Error") -or ($_.JobState -like "Error") }

$Errors | Remove-BitsTransfer -ErrorAction SilentlyContinue
Invoke-Expression -Command 'sc.exe sdset bits "D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)"' | out-null

 

 

 

1 Reply
best response confirmed by dcs19 (Copper Contributor)
Solution

@dcs19 - You can clear out individual jobs and cached entries using the remove-bitstransfer cmdlet. https://docs.microsoft.com/en-us/powershell/module/bitstransfer/remove-bitstransfer?view=win10-ps

1 best response

Accepted Solutions
best response confirmed by dcs19 (Copper Contributor)
Solution

@dcs19 - You can clear out individual jobs and cached entries using the remove-bitstransfer cmdlet. https://docs.microsoft.com/en-us/powershell/module/bitstransfer/remove-bitstransfer?view=win10-ps

View solution in original post