小编Phi*_*ppe的帖子

Powershell v5.1 Invoke-RestMethod 并绕过代理

我目前使用的是 Powershell V5.1,并且希望在 Invoke-RestMethod 命令上绕过 Internet Explorer 代理。

在 Powershell V6 中,有 -NoProxy 选项,指示 cmdlet 将不使用代理来到达目标。这是为了绕过 Internet Explorer 中配置的代理,这正是我想要做的。

在 Powershell V6 中,代码类似于:

$Result = Invoke-RestMethod -Uri $url  -NoProxy
Run Code Online (Sandbox Code Playgroud)

V5.1 有解决方法吗?

谢谢,菲利普

powershell proxy powershell-v6.0 powershell-v5.1

6
推荐指数
2
解决办法
2万
查看次数

powershell数组add-member - 寻找优雅的代码

我有一个非常基本的PowerShell数组:$ TestArray有2个文本列:Price和TimeStamp(这就是我得到它们的方式,没有什么可以做的):

Price  TimeStamp       
-----  ----------------       
0.0567 1542056680.72746
0.0567 1542056650.34414
0.0555 1542056197.46668
0.0551 1542056167.28967
Run Code Online (Sandbox Code Playgroud)

我想,在单个PowerShell行中添加一个舍入Time2值

$Time2 = [math]::Round($TestArray.TimeStamp)
Run Code Online (Sandbox Code Playgroud)

我想的代码是:

 $TestArray | Add-Member -Name Time2 -MemberType NoteProperty -Value { [math]::Round($Table.TimeStamp) }
Run Code Online (Sandbox Code Playgroud)

当然,我可以做一个ForEach循环; 它可以很容易地处理它,但我想在这一行代码中实现这一点.

任何的想法 ?

干杯,菲利普

arrays powershell pipeline

3
推荐指数
1
解决办法
67
查看次数