Aids in discovering HTTP and HTTPS connectivity issues. #nsacyber
Aids in discovering HTTP and HTTPS connectivity issues. Includes a PowerShell module named HttpConnectivityTester along with example PowerShell scripts to use the module.
To get started using the tools:
Download the current code to your Downloads folder. It will be saved as HTTP-Connectivity-Tester-master.zip by default.
The PowerShell commands are meant to run from a system with at least PowerShell 4.0 and .Net 4.5 installed. PowerShell may need to be configured to run the commands.
Users may need to change the default PowerShell execution policy. This can be achieved in a number of different ways:
Users will need to unblock the downloaded zip file since it will be marked as having been downloaded from the Internet (Mark of the Web) which PowerShell will block from executing by default. Open a PowerShell prompt and run the following commands to unblock the PowerShell code in the zip file:
cd $env:USERPROFILE
cd Downloads
Unblock-File -Path '.\HTTP-Connectivity-Tester-master.zip'
Running the PowerShell scripts inside the zip file without unblocking the file will result in the following warning:
Security warning Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run C:\users\user\Downloads\script.ps1? [D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):
If the downloaded zip file is not unblocked before extracting it, then all the individual PowerShell files that were in the zip file will have to be unblocked. You will need to run the following command after Step 5 in the Loading the code section:
Get-ChildItem -Path '.\HTTP-Connectivity-Tester' -Recurse -Include '*.ps1','*.psm1','*.psd1' | Unblock-File -Verbose
See the Unblock-File command's documentation for more information on how to use it.
mv .\HTTP-Connectivity-Tester-master\ .\HTTP-Connectivity-Tester\
or
Expand-Archive -Path .\HTTP-Connectivity-Tester-master.zip -DestinationPath .\
The Expand-Archive command is available starting with PowerShell 5.0.
Extract the downloaded zip file and install the HttpConnectivityTester PowerShell module.
cd HTTP-Connectivity-Tester
mv .\HttpConnectivityTester "$env:USERPROFILE\Documents\WindowsPowerShell\Modules"
cd .\Examples
from the extracted downloadcd .\Microsoft
cd .\WindowsTelemetry\
Import-Module -Name .\WindowsTelemetryConnectivity.psm1
Call the main Get- command (e.g. Get-WindowsTelemetryConnectivity
) after importing the product/service specific connectivity test to execute the test. The main Get- command is named after the file name. For example, Get-WindowsTelemetryConnectivity is the main Get- command for the WindowsTelemetryConnectivity.psm1 file. The main Get- command is Get-WDATPConnectivity for the WDATPConnectivity.psm1 file. The product/service specific Get- command is a wrapper around the Get-HttpConnectivity command provided by the PowerShell module.
The main Get- command for each connectivity test supports the same common options:
Some Get- commands support additional unique options that can be discovered by running the built-in Get-Help command on the main Get- command (e.g. Get-Help Get-WindowsTelemetryConnectivity -Detailed
).
An example for running, viewing, and saving a connectivity test:
cd .\Examples\Microsoft\WindowsTelemetry\
Import-Module -Name .\WindowsTelemetryConnectivity.psm1
$connectivity = Get-WindowsTelemetryConnectivity -Verbose
$connectivity | Format-List -Property Blocked,TestUrl,UnblockUrl,DnsAliases,IpAddresses,Description,Resolved,ActualStatusCode,ExpectedStatusCode,UnexpectedStatus
Save-HttpConnectivity -Objects $connectivity -FileName ('WindowsTelemetryConnectivity_{0:yyyyMMdd_HHmmss}' -f (Get-Date))
The main Get- command returns a Connectivity object that contains more information about the connectivity test. The main properties of interest from the Connectivity object that are useful for determining if a URL or service is blocked or functional are:
See Interpreting results for more information.
The Connectivity object can be saved to a JSON file using the Save-HttpConnectivity command from the PowerShell module. The Save-HttpConnectivity command supports the following options:
The table below documents the currently implemented connectivity tests in the Examples folder.
Additional documentation is available in the documentation folder.
See LICENSE.
See CONTRIBUTING.
See DISCLAIMER.