-
Notifications
You must be signed in to change notification settings - Fork 0
/
VMM_ChangeBITSTcpPort.ps1
55 lines (44 loc) · 2.44 KB
/
VMM_ChangeBITSTcpPort.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#####################################################################################################################
#
# Creator: Ramazan Can
# Date Created: 16/02/2018
# Last Modified:
#
# - this script is to change the registry value for BITSTcpPort, 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:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Agent\Setup"
$RegVMMServer ="HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Settings"
$keypresentVMMServer=Get-ItemProperty -Path $RegVMMServer -ea 0
$keypresentVMMAgent=Get-ItemProperty -Path $RegVMMAgent -ea 0
[int]$BITSTcpPort="5987"
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
}
}
}