|
|
楼主 |
发表于 2019-6-15 21:31:46
|
显示全部楼层
本帖最后由 bigjohn 于 2019-6-15 21:40 编辑
回复 3# xczxczxcz
Get-Content : 无法绑定参数“Encoding”。由于枚举值无效,无法将值“Default”转换为类型“Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding”。请指定以下枚举值之一,然后重试。可能的枚举值为“Unknown、String、Unicode、Byte、BigEndianUnicode、UTF8、UTF7、Ascii
”。
所在位置 行:1 字符: 34
+ $IP =(gc IP.txt -ReadCount 0 -enc <<<< Default) | %{
+ CategoryInfo : InvalidArgument: ( [Get-Content], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.GetContentCommand
正在测试连接 =......Test-Connection : 无法对参数“ComputerName”执行参数验证。该参数为 Null 或为空。请提供一个不为 Null 或不为空的参数,然后重试此命令。
所在位置 行:15 字符: 31
+ $n =Test-Connection -Computer <<<< $i.ip -Count 10 -ErrorAction 'SilentlyContinue';
+ CategoryInfo : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand
不能对值为空的表达式调用方法。
所在位置 行:18 字符: 31
+ $offLine +=$i.index.ToString <<<< ()+' '+$i.name+' '+$i.ip;
+ CategoryInfo : InvalidOperation: (ToString:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
失败
还是得好好请教大神,感觉像天书呀。非常佩服,这么快就编写好了。
我的电脑是win7 sp1 ,用自带powershell_ise 运行显示以上错误。
麻烦看看是什么原因? 多谢了。 |
|