Last active
          June 19, 2023 15:47 
        
      - 
      
- 
        Save jwmoss/1277a93024bb08f14aea87c4d488e709 to your computer and use it in GitHub Desktop. 
    adcheck
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ## Get all DCs | |
| $ports = @( | |
| "135", ## TCP | |
| "389", ## TCP/UDP | |
| "636", ## TCP | |
| "3268", ## TCP | |
| "3269", ## TCP | |
| "53", ## TCP/UDP | |
| "88", ## TCP/UDP | |
| "445" ## TCP | |
| ) | |
| $Servers = @() | |
| Foreach ($thing in $Servers) { | |
| foreach ($p in $ports) { | |
| [PSCustomobject]@{ | |
| From = $env:COMPUTERNAME | |
| To = $thing | |
| Port = $p | |
| Result = (Test-NetConnection -ComputerName $thing -Port $p).TcpTestSucceeded | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment