IIS 10 - list of connections with information about virtual directory for each connection

Raginya Alexandr 1 Reputation point
2021-11-03T03:32:26.44+00:00

Hello. In IIS 10 I need to see active connections with information with what connection is established to which virtual directory ( not site ) . Is it possible ?

Windows development | Internet Information Services
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Bruce Zhang-MSFT 3,771 Reputation points
    2021-11-03T09:07:04.337+00:00

    Hi @Raginya Alexandr ,

    It may difficult to see all active connections. If many clients send requests to same virtual directory, these connections are active but also repeated. So it is better to list all connections to virtual directory whatever they are active or inactive.

    Using this powershell commands:

    Import-Module WebAdministration  
    $Websites = Get-ChildItem IIS:\Sites   
      
    $AllVDirs = @()  
      
    foreach($Site in $Websites)  
    {  
        $VDirs = Get-WebVirtualDirectory -Site $Site.name  
        foreach($webvdirectory in $VDirs)  
        {  
                $vdir = New-Object psobject -Property @{  
                    "Name" = ($webvdirectory.path -split "/")[-1]  
                    "Site" = $Site.name  
                    "Path" = $webvdirectory.path  
                    "PhysicalPath" = $webvdirectory.physicalPath  
                    "PhysicalPathCredentials" = $webvdirectory.userName  
                }  
      
                $AllVDirs += $vdir  
        }   
    }  
      
    $AllVDirs  
    

    146161-1.jpg

    0 comments No comments

  2. Raginya Alexandr 1 Reputation point
    2021-11-03T11:05:28.007+00:00

    Hello. When i run this script, it shows nothing:

    146167-image.png


  3. Raginya Alexandr 1 Reputation point
    2021-11-04T08:39:32.73+00:00

    Hello. There are alot of VDs on IIS:

    146531-image.png


  4. Raginya Alexandr 1 Reputation point
    2021-11-05T08:55:20.29+00:00

    Oh, so i'de asked the wrong question.
    I need a script that display connections to applications on IIS .


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.