Test-NetConnection:术语 'Test-NetConnection' 未被识别为 cmdlet、函数、脚本文件或可执行程序的名称

Test-NetConnection: The term 'Test-NetConnection' is not recognized as a name of a cmdlet, function, script file, or executable program

我想将文件共享从 Azure 门户连接到我的 windows 笔记本电脑。但是,相关错误如下所示。

$connectTestResult = Test-NetConnection -ComputerName storagetestmy3.file.core.windows.net -Port 445
if ($connectTestResult.TcpTestSucceeded) {
    # Save the password so the drive will persist on reboot
    cmd.exe /C "cmdkey /add:`"storagetestmy3.file.core.windows.net`" /user:`"localhost\storagetestmy3`" /pass:`"ZvWYXdvAkX112rT8k2MxQLqlcDi1oA+EZNNoGeQ2Bv88DDUWFdtcmbXXfKk/mHNMlw1TDVX3Vrkb+AStoh/kOQ==`""
    # Mount the drive
    New-PSDrive -Name Z -PSProvider FileSystem -Root "\storagetestmy3.file.core.windows.net\fileshare3" -Persist
} else {
    Write-Error -Message "Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."
}

错误:Test-NetConnection:术语 'Test-NetConnection' 未被识别为 cmdlet、函数、脚本文件或可执行程序的名称。 检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。

在 Windows 笔记本电脑中打开 Latest Version of PowerShell 并 运行 Test-NetConnection 命令。

cmdlet 运行成功: