B.I.T.S - Background Intelligent Transfer Service - is also utilized by VMM for a.e. file transfer purposes and if you come across to change the port manually, you basically have to touch the registry of each SCVMM managed computer as there is no way to do this in UI. Especially when you have large scale deployments, PowerShell more specific the VMM module become your best friend
The script is really very simple and goes and checks out what key is present and modifies this based on VMM server or agent deployment, that makes it easy and we can run that script over all VMM managed computers doesn't matter if clustered or standalone deployment
first of all we collect computers from VMM and command to use here is Get-SCVMMManagedComputer
next is the foreach loop to walkthrough of all computers and use a invoke-command with parameter -Scriptblock which has remote capabilities and execute Set-ItemProperty to update BITSTcpPort value. as I mentioned, this is depending of role server / agent therefore I created a check before and based on results I execute the right pattern
Please Note: In my example I had used TCP port 5986 - [int]$BITSTcpPort="5986" - but you can change it to any non-well known port in your environment
You probably have seen that I do not automatically restart VMM server service so if you want to have that automated too, just remove the # before restart-service command
![]()
Once the above change was completed, I did run into following VMM deployment error
Error (2940)
VMM is unable to complete the requested file transfer. The connection to the HTTP server vmmserver.contoso.com could not be established.
Unknown error (0x80072ee2)
Recommended Action
Ensure that the HTTP service and/or the agent on the machine vmmserver.contoso.com are installed and running and that a firewall is not blocking HTTP/HTTPS traffic on the configured port.
0x80072ee2 - WININET_E_TIMEOUT - this looks like communication issues so I did some further investigation and finally root cause was the local firewall was blocking the new ports which we configured above. Which makes sense, as this is a non-well-known port and therefore blocked, so all good. if you have Windows firewall configured and actively running, you need to configure exceptions for those new ports we are using for BITS communication in my example TCP 5986. for Windows firewall you can use New-NetFirewallRule or netsh command
New-NetFirewallRule -DisplayName 'VMM BITSTcPort Inbound' -Profile @('Domain', 'Private') -Direction Inbound -Action Allow -Protocol TCP -LocalPort @('5985', '5986')
https://social.technet.microsoft.com/wiki/contents/articles/18465.vmm-2012-change-bits-port-used-for-template-provisioning-bits-over-https.aspx
here are also few related articles around VMM, BITS and WMI
https://social.technet.microsoft.com/wiki/contents/articles/9058.troubleshoot-vmm-bits-troubleshooting.aspx
https://social.technet.microsoft.com/wiki/contents/articles/9048.wmi-troubleshooting-for-vmm.aspx
Script Example:
################### START
#####################################################################################################################
#
# Creator: Ramazan Can
# Date Created: 16/02/2018
# Last Modified:
#
# - this script is to change the registry value for BITSTcpPort for all SCVMM Managed Computers, the port number can be modified at line34
#
#####################################################################################################################
cls
""
""
$vmms=Read-Host "VMMServer "
""
"Getting all VMM Managed Computers..."
$allvmmmanagedcomputers= (Get-SCVMMManagedComputer -VMMServer $vmms).Name | sort
$allcompcount=$allvmmmanagedcomputers.Count
"Done - $allcompcount total SCVMM managed computers found - starting foreach loop..."
""
foreach ($comp in $allvmmmanagedcomputers) {
""
Write-Host "Checking key on node $comp"
Invoke-Command -ComputerName $comp -ScriptBlock {
$RegVMMAgent ="HKLM:SOFTWAREMicrosoftMicrosoft System Center Virtual Machine Manager AgentSetup"
$RegVMMServer ="HKLM:SOFTWAREMicrosoftMicrosoft System Center Virtual Machine Manager ServerSettings"
$keypresentVMMServer=Get-ItemProperty -Path $RegVMMServer -ea 0
$keypresentVMMAgent=Get-ItemProperty -Path $RegVMMAgent -ea 0
[int]$BITSTcpPort="5986"
if ($keypresentVMMServer) {
Write-Host "VMMServer Key found, doing required BITSTcpPort change"
Set-ItemProperty -Path $RegVMMServer -Name BITSTcpPort -Value $BITSTcpPort
Write-Host "Done - New BITSPort is changed to $BITSTcpPort, please restart manually VMM Server service to take effect" -ForegroundColor Yellow
#Restart-Service SCVMMService # VMM Server service
#Restart-Service SCVMMAgent # VMM Agent service
}
if ($keypresentVMMAgent) {
Write-Host "VMMAgent Key found, doing required BITSTcpPort change"
Set-ItemProperty -Path $RegVMMAgent -Name BITSTcpPort -Value $BITSTcpPort
Write-Host "Done - New BITSPort is changed to $BITSTcpPort, restarting VMM Agent to take effect" -ForegroundColor Green
Restart-Service SCVMMAgent
}
}
}
################### END