From b1619045ffbec8088992768de3d22a1f2ebb2b4a Mon Sep 17 00:00:00 2001 From: Gary Moore Date: Thu, 14 Oct 2021 11:48:52 -0700 Subject: [PATCH 1/9] Applied valid slugs for labeling code blocks The complete list is here: https://review.docs.microsoft.com/en-us/help/contribute/metadata-taxonomies?branch=master#dev-lang --- .../troubleshoot-tcpip-port-exhaust.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/windows/client-management/troubleshoot-tcpip-port-exhaust.md b/windows/client-management/troubleshoot-tcpip-port-exhaust.md index d3a3ceb2db..10fbfe6f45 100644 --- a/windows/client-management/troubleshoot-tcpip-port-exhaust.md +++ b/windows/client-management/troubleshoot-tcpip-port-exhaust.md @@ -39,7 +39,7 @@ You can view the dynamic port range on a computer by using the following netsh c The range is set separately for each transport (TCP or UDP). The port range is now a range that has a starting point and an ending point. Microsoft customers who deploy servers that are running Windows Server may have problems that affect RPC communication between servers if firewalls are used on the internal network. In these situations, we recommend that you reconfigure the firewalls to allow traffic between servers in the dynamic port range of **49152** through **65535**. This range is in addition to well-known ports that are used by services and applications. Or, the port range that is used by the servers can be modified on each server. You adjust this range by using the netsh command, as follows. The above command sets the dynamic port range for TCP. -```cmd +```console netsh int set dynamic start=number num=range ``` @@ -107,7 +107,7 @@ You may also see CLOSE_WAIT state connections in the same output, however CLOSE_ 4. Open a command prompt in admin mode and run the below command - ```cmd + ```console Netsh trace start scenario=netconnection capture=yes tracefile=c:\Server.etl ``` @@ -121,7 +121,7 @@ The key is to identify which process or application is using all the ports. Belo Start by looking at the netstat output. If you are using Windows 10 or Windows Server 2016, then you can run the command `netstat -anobq` and check for the process ID which has maximum entries as BOUND. Alternately, you can also run the below Powershell command to identify the process: -```Powershell +```powershell Get-NetTCPConnection | Group-Object -Property State, OwningProcess | Select -Property Count, Name, @{Name="ProcessName";Expression={(Get-Process -PID ($_.Name.Split(',')[-1].Trim(' '))).Name}}, Group | Sort Count -Descending ``` @@ -165,7 +165,7 @@ Finally, if the above methods did not help you isolate the process, we suggest y As a workaround, rebooting the computer will get the it back in normal state and would help you resolve the issue for the time being. However, when a reboot is impractical, you can also consider increasing the number of ports on the machine using the below commands: -```cmd +```console netsh int ipv4 set dynamicport tcp start=10000 num=1000 ``` @@ -176,7 +176,7 @@ This will set the dynamic port range to start at port 10000 and to end at port 1 For Windows 7 and Windows Server 2008 R2, you can use the below script to collect the netstat output at defined frequency. From the outputs, you can see the port usage trend. -``` +```console @ECHO ON set v=%1 :loop From 05d50c14123517ecb7105d86d7fdd53b3ed691a9 Mon Sep 17 00:00:00 2001 From: Gary Moore Date: Thu, 14 Oct 2021 11:52:51 -0700 Subject: [PATCH 2/9] Corrected indentation of images & second-level list items These images should have been indented as part of their respective second-level list items. For this to work correctly, though, the second-level list items also needed to be laid out correctly, and that often doesn't happen unless the list items rely on automatic numbering (1, 1, 1) instead of specifying the enumeration (a, b, c). --- .../client-management/troubleshoot-tcpip-port-exhaust.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/windows/client-management/troubleshoot-tcpip-port-exhaust.md b/windows/client-management/troubleshoot-tcpip-port-exhaust.md index 10fbfe6f45..a09a0c7ea4 100644 --- a/windows/client-management/troubleshoot-tcpip-port-exhaust.md +++ b/windows/client-management/troubleshoot-tcpip-port-exhaust.md @@ -82,13 +82,13 @@ If you suspect that the machine is in a state of port exhaustion: 2. Open event viewer and under the system logs, look for the events which clearly indicate the current state: - a. **Event ID 4227** + 1. **Event ID 4227** - ![Screenshot of event id 4227 in Event Viewer.](images/tcp-ts-18.png) + ![Screenshot of event id 4227 in Event Viewer.](images/tcp-ts-18.png) - b. **Event ID 4231** + 1. **Event ID 4231** - ![Screenshot of event id 4231 in Event Viewer.](images/tcp-ts-19.png) + ![Screenshot of event id 4231 in Event Viewer.](images/tcp-ts-19.png) 3. Collect a `netstat -anob` output from the server. The netstat output will show you a huge number of entries for TIME_WAIT state for a single PID. From 2503158cabfdfc6ba9ee37c1d035161ecde678ce Mon Sep 17 00:00:00 2001 From: Gary Moore Date: Thu, 14 Oct 2021 11:59:13 -0700 Subject: [PATCH 3/9] Added lightbox functionality to some images These images aren't easy to read. Lightbox allows the images to be viewed in an expanded window. --- .../client-management/troubleshoot-tcpip-port-exhaust.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/windows/client-management/troubleshoot-tcpip-port-exhaust.md b/windows/client-management/troubleshoot-tcpip-port-exhaust.md index a09a0c7ea4..b7b25c7d2d 100644 --- a/windows/client-management/troubleshoot-tcpip-port-exhaust.md +++ b/windows/client-management/troubleshoot-tcpip-port-exhaust.md @@ -58,7 +58,7 @@ Since outbound connections start to fail, you will see a lot of the below behavi - Unable to sign in to the machine with domain credentials, however sign-in with local account works. Domain sign-in will require you to contact the DC for authentication which is again an outbound connection. If you have cache credentials set, then domain sign-in might still work. - ![Screenshot of error for NETLOGON in Event Viewer.](images/tcp-ts-14.png) + :::image type="content" alt-text="Screenshot of error for NETLOGON in Event Viewer." source="images/tcp-ts-14.png" lightbox="images/tcp-ts-14.png"::: - Group Policy update failures: @@ -84,11 +84,11 @@ If you suspect that the machine is in a state of port exhaustion: 1. **Event ID 4227** - ![Screenshot of event id 4227 in Event Viewer.](images/tcp-ts-18.png) + :::image type="content" alt-text="Screenshot of event ID 4227 in Event Viewer." source="images/tcp-ts-18.png" lightbox="images/tcp-ts-18.png"::: 1. **Event ID 4231** - ![Screenshot of event id 4231 in Event Viewer.](images/tcp-ts-19.png) + :::image type="content" alt-text="Screenshot of event ID 4231 in Event Viewer." source="images/tcp-ts-19.png" lightbox="images/tcp-ts-19.png"::: 3. Collect a `netstat -anob` output from the server. The netstat output will show you a huge number of entries for TIME_WAIT state for a single PID. @@ -157,7 +157,7 @@ Steps to use Process explorer: File \Device\AFD - ![Screenshot of Process Explorer.](images/tcp-ts-22.png) + :::image type="content" alt-text="Screenshot of Process Explorer." source="images/tcp-ts-22.png" lightbox="images/tcp-ts-22.png"::: 10. Some are normal, but large numbers of them are not (hundreds to thousands). Close the process in question. If that restores outbound connectivity, then you have further proven that the app is the cause. Contact the vendor of that app. From eacfe32e51fd32f391a9f3f6945be9871c4af381 Mon Sep 17 00:00:00 2001 From: Gary Moore Date: Thu, 14 Oct 2021 12:02:03 -0700 Subject: [PATCH 4/9] Updated code block label to a valid value The complete list is here: https://review.docs.microsoft.com/en-us/help/contribute/metadata-taxonomies?branch=master#dev-lang --- windows/client-management/mandatory-user-profile.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/client-management/mandatory-user-profile.md b/windows/client-management/mandatory-user-profile.md index 8b2e2bc3e9..5a566f1410 100644 --- a/windows/client-management/mandatory-user-profile.md +++ b/windows/client-management/mandatory-user-profile.md @@ -68,7 +68,7 @@ First, you create a default user profile with the customizations that you want, 1. At a command prompt, type the following command and press **ENTER**. - ```dos + ```console sysprep /oobe /reboot /generalize /unattend:unattend.xml ``` From e89a0f19ffc81e4d9846b4d3c3a80fbbbfaccddf Mon Sep 17 00:00:00 2001 From: Gary Moore Date: Thu, 14 Oct 2021 12:04:21 -0700 Subject: [PATCH 5/9] Indented images in second-level list items --- windows/client-management/mandatory-user-profile.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/client-management/mandatory-user-profile.md b/windows/client-management/mandatory-user-profile.md index 5a566f1410..25245fa812 100644 --- a/windows/client-management/mandatory-user-profile.md +++ b/windows/client-management/mandatory-user-profile.md @@ -100,11 +100,11 @@ First, you create a default user profile with the customizations that you want, - If the device is joined to the domain and you are signed in with an account that has permissions to write to a shared folder on the network, you can enter the shared folder path. - ![Example of Copy profile to.](images/copy-to-path.png) + ![Example of Copy profile to.](images/copy-to-path.png) - If the device is not joined to the domain, you can save the profile locally and then copy it to the shared folder location. - ![Example of Copy To UI with UNC path.](images/copy-to-path.png) + ![Example of Copy To UI with UNC path.](images/copy-to-path.png) 1. Click **OK** to copy the default user profile. From 8ffec9b20f1f0249aa9b83b7f6f4370163cb069d Mon Sep 17 00:00:00 2001 From: Gary Moore Date: Thu, 14 Oct 2021 12:19:57 -0700 Subject: [PATCH 6/9] Indented note in a list item --- .../manage-device-installation-with-group-policy.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/client-management/manage-device-installation-with-group-policy.md b/windows/client-management/manage-device-installation-with-group-policy.md index cadcf9664a..8e177ae184 100644 --- a/windows/client-management/manage-device-installation-with-group-policy.md +++ b/windows/client-management/manage-device-installation-with-group-policy.md @@ -342,8 +342,8 @@ Getting the right device identifier to prevent it from being installed: > ClassGuid = {4d36e979-e325-11ce-bfc1-08002be10318}\ > This class includes printers. -> [!NOTE] -> As mentioned before, preventing an entire Class could block you from using your system completely. Please make sure you understand which devices are going to be blocked when specifying a Class. For our scenario, there are other classes that relate to printers but before you apply them, make sure they are not blocking any other existing device that is crucial to your system. + > [!NOTE] + > As mentioned before, preventing an entire Class could block you from using your system completely. Please make sure you understand which devices are going to be blocked when specifying a Class. For our scenario, there are other classes that relate to printers but before you apply them, make sure they are not blocking any other existing device that is crucial to your system. Creating the policy to prevent all printers from being installed: From 746eb537749f49d492fbbc48a267a8f355fb26fc Mon Sep 17 00:00:00 2001 From: Gary Moore Date: Thu, 14 Oct 2021 14:01:19 -0700 Subject: [PATCH 7/9] Applied ordered list to sequential steps --- .../manage-device-installation-with-group-policy.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/windows/client-management/manage-device-installation-with-group-policy.md b/windows/client-management/manage-device-installation-with-group-policy.md index 8e177ae184..4088d331ab 100644 --- a/windows/client-management/manage-device-installation-with-group-policy.md +++ b/windows/client-management/manage-device-installation-with-group-policy.md @@ -376,9 +376,9 @@ Creating the policy to prevent all printers from being installed: 1. If you have not completed step #9 – follow these steps: - - Uninstall your printer: Device Manager > Printers > right click the Canon Printer > click “Uninstall device”. - - For USB printer – unplug and plug back the cable; for network device – make a search for the printer in the Windows Settings app. - - You should not be able to reinstall the printer. + 1. Uninstall your printer: Device Manager > Printers > right click the Canon Printer > click “Uninstall device”. + 1. For USB printer – unplug and plug back the cable; for network device – make a search for the printer in the Windows Settings app. + 1. You should not be able to reinstall the printer. 2. If you completed step #9 above and restarted the machine, simply look for your printer under Device Manager or the Windows Settings app and see that it is no-longer available for you to use. From a8c5f1480a6c6d5cb67bcc4525172b56b03897b3 Mon Sep 17 00:00:00 2001 From: Gary Moore Date: Thu, 14 Oct 2021 20:23:08 -0700 Subject: [PATCH 8/9] Acrolinx: "Powershell" --- windows/client-management/troubleshoot-tcpip-port-exhaust.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/client-management/troubleshoot-tcpip-port-exhaust.md b/windows/client-management/troubleshoot-tcpip-port-exhaust.md index b7b25c7d2d..772f2ec791 100644 --- a/windows/client-management/troubleshoot-tcpip-port-exhaust.md +++ b/windows/client-management/troubleshoot-tcpip-port-exhaust.md @@ -119,7 +119,7 @@ The key is to identify which process or application is using all the ports. Belo ### Method 1 -Start by looking at the netstat output. If you are using Windows 10 or Windows Server 2016, then you can run the command `netstat -anobq` and check for the process ID which has maximum entries as BOUND. Alternately, you can also run the below Powershell command to identify the process: +Start by looking at the netstat output. If you are using Windows 10 or Windows Server 2016, then you can run the command `netstat -anobq` and check for the process ID which has maximum entries as BOUND. Alternately, you can also run the below PowerShell command to identify the process: ```powershell Get-NetTCPConnection | Group-Object -Property State, OwningProcess | Select -Property Count, Name, @{Name="ProcessName";Expression={(Get-Process -PID ($_.Name.Split(',')[-1].Trim(' '))).Name}}, Group | Sort Count -Descending @@ -127,7 +127,7 @@ Get-NetTCPConnection | Group-Object -Property State, OwningProcess | Select -Pro Most port leaks are caused by user-mode processes not correctly closing the ports when an error was encountered. At the user-mode level ports (actually sockets) are handles. Both **TaskManager** and **ProcessExplorer** are able to display handle counts which allows you to identify which process is consuming all of the ports. -For Windows 7 and Windows Server 2008 R2, you can update your Powershell version to include the above cmdlet. +For Windows 7 and Windows Server 2008 R2, you can update your PowerShell version to include the above cmdlet. ### Method 2 From d97fae2a49c0fe1a2453a7011c6c85107f96e991 Mon Sep 17 00:00:00 2001 From: Gary Moore Date: Thu, 14 Oct 2021 20:31:37 -0700 Subject: [PATCH 9/9] Indent multiple types of content in Step 3 --- .../troubleshoot-tcpip-port-exhaust.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/windows/client-management/troubleshoot-tcpip-port-exhaust.md b/windows/client-management/troubleshoot-tcpip-port-exhaust.md index 772f2ec791..1267dad41f 100644 --- a/windows/client-management/troubleshoot-tcpip-port-exhaust.md +++ b/windows/client-management/troubleshoot-tcpip-port-exhaust.md @@ -94,16 +94,16 @@ If you suspect that the machine is in a state of port exhaustion: ![Screenshot of netstate command output.](images/tcp-ts-20.png) -After a graceful closure or an abrupt closure of a session, after a period of 4 minutes (default), the port used the process or application would be released back to the available pool. During this 4 minutes, the TCP connection state will be TIME_WAIT state. In a situation where you suspect port exhaustion, an application or process will not be able to release all the ports that it has consumed and will remain in the TIME_WAIT state. - -You may also see CLOSE_WAIT state connections in the same output, however CLOSE_WAIT state is a state when one side of the TCP peer has no more data to send (FIN sent) but is able to receive data from the other end. This state does not necessarily indicate port exhaustion. - ->[!Note] ->Having huge connections in TIME_WAIT state does not always indicate that the server is currently out of ports unless the first two points are verified. Having lot of TIME_WAIT connections does indicate that the process is creating lot of TCP connections and may eventually lead to port exhaustion. -> ->Netstat has been updated in Windows 10 with the addition of the **-Q** switch to show ports that have transitioned out of time wait as in the BOUND state. An update for Windows 8.1 and Windows Server 2012 R2 has been released that contains this functionality. The PowerShell cmdlet `Get-NetTCPConnection` in Windows 10 also shows these BOUND ports. -> ->Until 10/2016, netstat was inaccurate. Fixes for netstat, back-ported to 2012 R2, allowed Netstat.exe and Get-NetTcpConnection to correctly report TCP or UDP port usage in Windows Server 2012 R2. See [Windows Server 2012 R2: Ephemeral ports hotfixes](https://support.microsoft.com/help/3123245/update-improves-port-exhaustion-identification-in-windows-server-2012) to learn more. + After a graceful closure or an abrupt closure of a session, after a period of 4 minutes (default), the port used the process or application would be released back to the available pool. During this 4 minutes, the TCP connection state will be TIME_WAIT state. In a situation where you suspect port exhaustion, an application or process will not be able to release all the ports that it has consumed and will remain in the TIME_WAIT state. + + You may also see CLOSE_WAIT state connections in the same output, however CLOSE_WAIT state is a state when one side of the TCP peer has no more data to send (FIN sent) but is able to receive data from the other end. This state does not necessarily indicate port exhaustion. + + >[!Note] + >Having huge connections in TIME_WAIT state does not always indicate that the server is currently out of ports unless the first two points are verified. Having lot of TIME_WAIT connections does indicate that the process is creating lot of TCP connections and may eventually lead to port exhaustion. + > + >Netstat has been updated in Windows 10 with the addition of the **-Q** switch to show ports that have transitioned out of time wait as in the BOUND state. An update for Windows 8.1 and Windows Server 2012 R2 has been released that contains this functionality. The PowerShell cmdlet `Get-NetTCPConnection` in Windows 10 also shows these BOUND ports. + > + >Until 10/2016, netstat was inaccurate. Fixes for netstat, back-ported to 2012 R2, allowed Netstat.exe and Get-NetTcpConnection to correctly report TCP or UDP port usage in Windows Server 2012 R2. See [Windows Server 2012 R2: Ephemeral ports hotfixes](https://support.microsoft.com/help/3123245/update-improves-port-exhaustion-identification-in-windows-server-2012) to learn more. 4. Open a command prompt in admin mode and run the below command