可能重复:
获取$ webclient.downloadstring以写入Powershell Powershell http 文本中的文本文件,
其中包含.cer for auth
我有一个SMS系统,使我能够从HTTP GET请求发送SMS:
http://smsserver/SNSManager/msgSend.jsp?uid&to=smartsms:*+001XXXXXX&msg="text of the message"&encoding=windows-1255
Run Code Online (Sandbox Code Playgroud)
我想在PowerShell中输入文本的详细信息,然后浏览此URL.我该怎么做?
我使用powershell来检查我的计算机上是否打开了端口.我有8台Windows 2008 R2机器,我运行以下脚本:
$localhost = get-content env:computername
foreach($port in get-content "\\computer1\txtfiles\ports.txt")
{
foreach ($hostname in get-content "\\compiuter1\txtfiles\servers.txt")
{
try {
$sock = new-object System.Net.Sockets.Socket -ArgumentList $([System.Net.Sockets.AddressFamily]::InterNetwork),$([System.Net.Sockets.SocketType]::Stream),$([System.Net.Sockets.ProtocolType]::Tcp)
$sock.Connect($hostname,$Port)
$output = $localhost+","+$hostname+","+$port+","+$sock.Connected
$output
$sock.Close()
}
catch {
$output = $localhost+","+$hostname+","+$port+","+$sock.Connected
$output
}
}
Run Code Online (Sandbox Code Playgroud)
}
我在计算机1的8台计算机上运行此脚本,使用:
Invoke-Command -ComputerName computer1,computer2 -FilePath F:\scripts\port-test.ps1
Run Code Online (Sandbox Code Playgroud)
在第一台计算机上(计算机1 - 我执行脚本的机器)我得到了一个输出但是在计算机上我得到了:
Cannot find path '\\computer1\txtfiles' because it does not exist.
+ CategoryInfo : ObjectNotFound: (\\computer1\txt
files:String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
Run Code Online (Sandbox Code Playgroud)
为什么Powershell不会看到网络共享?我该如何解决?