You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Absent port from registry not supported (no default to 80)
Canonical url (ended with '/') not supported
My suggestions: If ((Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate -Name WUServer).WUServer -match '(?<Protocol>^http(s)?)(?:://)(?<Computername>(?:(?:[\w-]+(?:\.)?)+))(?::)?(?<Port>\d*)/?') { $WsusServer = $Matches.Computername; if ($Matches.Port) { $Port = $Matches.Port } }
Slightly corrected regex and test for empty port.
btw, isn't a time to correct default port to 8530 ?
sorry for formatting. cant get it as need
The text was updated successfully, but these errors were encountered:
I'm assuming that this all refers to Connect-PSWSUSServer...correct? At this point in time, you are correct that we can move the default port to 8530 and good catch on server names with a '-' in them. Good things to look at improving on with the next release.
Definitely, I'm talking about Connect-PSWSUSServer :)
btw, take into account that if default server port will be changed to 8530, than my code above need addition if ($Matches.Port) { $Port = $Matches.Port } else { $Port = 80 } #because default url without port equal to port=80
I'm still learning how Git-Hub works and how to contribute.... but there was a bug where the registry name was an alias that gave a fit when I tried connecting to it. I got around this by doing a DNS lookup. It would resolve and output the FQDN. Perhaps if your regex included everything between the first "//" and the last ":" and did a look up, it wouldn't matter? Still learning regex too, so not sure how that would work. Also not sure if all entries have a port...
What I use: $WsusServer = [System.Net.DNS]::GetHostEntry("$WsusServer").hostname
The gethostentry has an address list as well which you could cycle through to get around any name or alias. Could try/cycle the port too.
My suggestions:
If ((Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate -Name WUServer).WUServer -match '(?<Protocol>^http(s)?)(?:://)(?<Computername>(?:(?:[\w-]+(?:\.)?)+))(?::)?(?<Port>\d*)/?') { $WsusServer = $Matches.Computername; if ($Matches.Port) { $Port = $Matches.Port } }
Slightly corrected regex and test for empty port.
btw, isn't a time to correct default port to 8530 ?
sorry for formatting. cant get it as need
The text was updated successfully, but these errors were encountered: