Test-NetConnection (NetTCPIP)

# SMB, HTTP, WINRM, RDP or blank for ping
Test-NetConnection testdyn365web1 -CommonTCPPort SMB