- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
测试连接间歇性失败,并出现资源不足错误:
test-connection : Testing connection to computer 'SOMESERVER' failed: Error due to lack of resources
At line:1 char:45
+ ... ($server in $ServersNonProd.Name) { test-connection $server -Count 1}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (SOMESERVER:String) [Test-Connection], PingException
+ FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand
$Servers = Import-CSV -Path C:\Temp\Servers.csv
$result = foreach ($Name in $Servers.FQDN) {
$IP = $null
if ( Resolve-DNSName $Name -ErrorAction SilentlyContinue ) {
$IP = (Test-Connection -Count 1 -ComputerName $Name -ErrorAction SilentlyContinue).IPv4Address
if ( $IP -eq $null ) {
Start-Sleep -Milliseconds 100
$IP = (Test-Connection -Count 1 -ComputerName $Name -ErrorAction SilentlyContinue).IPv4Address
}
if ( $IP -eq $null ) {
Start-Sleep -Milliseconds 200
$IP = (Test-Connection -Count 1 -ComputerName $Name -ErrorAction SilentlyContinue).IPv4Address
}
if ( $IP -eq $null ) {
Start-Sleep -Milliseconds 300
$IP = (Test-Connection -Count 1 -ComputerName $Name -ErrorAction SilentlyContinue).IPv4Address
}
if ( $IP -eq $null ) {
Start-Sleep -Milliseconds 400
$IP = (Test-Connection -Count 1 -ComputerName $Name -ErrorAction SilentlyContinue).IPv4Address
}
}
new-object psobject -Property @{FQDN = $Name; "IP Address" = $IP}
}
最佳答案
在较新版本的PowerShell中,-Quiet
上的Test-Connection
参数似乎总是返回True
或False
。在旧版本上似乎无法始终如一地工作,但是要么我现在做的事情有所不同,要么他们做了改进:
$Ping = Test-Connection -ComputerName $ComputerName -Count 1 -Quiet
Test-Connection
不能很好地响应。也就是说,如果该cmdlet决定根本无法发送ping,则它将以不愉快的方式出错,难以捕获或忽略。
Test-Connection
仅在您可以保证DNS会将名称解析为地址并且始终存在网络时才有用。
$Ping = Get-WmiObject -Class Win32_PingStatus -Filter "Address='$ComputerName' AND Timeout=1000";
$Ping2 = Get-CimInstance -ClassName Win32_PingStatus -Filter "Address='$ComputerName' AND Timeout=1000";
$StatusCodes = @{
[uint32]0 = 'Success';
[uint32]11001 = 'Buffer Too Small';
[uint32]11002 = 'Destination Net Unreachable';
[uint32]11003 = 'Destination Host Unreachable';
[uint32]11004 = 'Destination Protocol Unreachable';
[uint32]11005 = 'Destination Port Unreachable';
[uint32]11006 = 'No Resources';
[uint32]11007 = 'Bad Option';
[uint32]11008 = 'Hardware Error';
[uint32]11009 = 'Packet Too Big';
[uint32]11010 = 'Request Timed Out';
[uint32]11011 = 'Bad Request';
[uint32]11012 = 'Bad Route';
[uint32]11013 = 'TimeToLive Expired Transit';
[uint32]11014 = 'TimeToLive Expired Reassembly';
[uint32]11015 = 'Parameter Problem';
[uint32]11016 = 'Source Quench';
[uint32]11017 = 'Option Too Big';
[uint32]11018 = 'Bad Destination';
[uint32]11032 = 'Negotiating IPSEC';
[uint32]11050 = 'General Failure'
};
$StatusCodes[$Ping.StatusCode];
$StatusCodes[$Ping2.StatusCode];
关于powershell - Powershell-由于缺乏资源,测试连接失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41267553/
我不明白为什么我的 Java 代码没有出现错误。我有一个使用泛型类型的类: import java.util.*; // For ArrayList public class Hat { pub
我正在 Pygame 中开发一款射击类游戏供我自己娱乐,在创建玩家的基本 Action 的过程中我遇到了一些疑问,“Dash”和“Switch”均未按预期工作。 ... def switch(self
当我加载一个显示的网页时,为什么我要为每个图像的 HTTP 请求打开一个新的 TCP 连接?为什么在页面加载期间不重复使用单个 TCP 连接? 最佳答案 我认为浏览器通常会打开多个连接,以便它可以并行
我一直在谷歌搜索,只能找到 a trivial example Compute Capability 3.0 中的新动态并行性在其链接的其中一份技术简报中介绍 from here .我知道 HPC 专
我使用 Telerik 和 Microsoft CDN,分别用于它们各自的 AJAX 工具包。两者在 99% 的情况下都工作得很好。然而,我最近在两家不同的咖啡馆工作并访问了我的网站:第一家咖啡馆不允
我在一家从事网络托管的 IT 公司工作,而且我个人对 SQL 非常缺乏经验*。 *看起来很糟糕 我的一个客户正在尝试将 Epos 系统与其 magento 网站集成,在 Epos 集成过程中,他们遇到
我的代码现在有一个循环,它调用蒙特卡洛函数来计算多个样本的简单积分(y=x,从 0 到 1),并将总时间和积分值写入文本文件。然后循环增加线程数并继续前进。现在大约有 8 个线程,时间峰值约为 2.6
所以 HTTP/2 增加了我想要利用的性能。出于各种原因,我不喜欢连接我的 javascript,而 HTTP/2 无论如何都会使它变得不必要。 但是。我正在开发一个将部署在客户本地网络中的网络应用程
我写了一个非常简单的 Haskell 程序: main = print $ sum $ map read ["55", "99", "101"] 鉴于我过去的经验,我预计会得到一个“歧义类型”错误,因
我是一名优秀的程序员,十分优秀!