Running powershell command Test-Netconnect on Windows 2012 server

Ben Lan 1 Reputation point
2020-08-18T22:20:52.467+00:00

I am trying to run a PS script on a Windows 2012 server to allow connection to Azure cloud. The script needs to use the cmd Test-NetConnect.

But this is not available on my server. PS version is 3.0.

How do I get this cmd imported on my server so I can connect it to the Azure cloud?

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,919 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Vaibhav Chaudhari 38,746 Reputation points
    2020-08-19T07:16:36.737+00:00

    Should it be "Test-NetConnection" which needs module - "nettcpip" imported as prerequisite. I see below document for this command -

    https://learn.microsoft.com/en-us/powershell/module/nettcpip/Test-NetConnection?view=winserver2012r2-ps

    ----------

    Please don't forget to Accept Answer and Up-vote if the response helped -- Vaibhav

    0 comments No comments

  2. Sumarigo-MSFT 47,021 Reputation points Microsoft Employee
    2020-08-19T11:20:33.227+00:00

    @Ben Lan Adding more information $computer = get-content c:\servers.txt
    Foreach($computer in $computers){
    (Test-connection -computerName $computer -count 1 -quiet) | out-file _filepath c:\gp\test.txt -Append}

    If the issue still persists, Please let me know for which azure service are you trying to connect or trying upload any data to Azure blob, Files?
    Also share the script, if possible hiding the PI data

    Additional information: There is also similar thread discussion here, please refer to the suggestion: https://stackoverflow.com/questions/47570866/powershell-cmdlet-test-netconnection-not-available?rq=1

    Test-NetConnection: https://learn.microsoft.com/en-us/previous-versions/windows/powershell-scripting/dn372891(v=wps.630)

    Hope this helps!

    Kindly let us know if the above helps or you need further assistance on this issue.

    ------------------------------------------------------------------------------------------------------------------------------------------------------------

    Please don’t forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


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.