Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PowerShell核心脚本中使用.NET核心接口IWebProxy_Powershell_.net Core - Fatal编程技术网

在PowerShell核心脚本中使用.NET核心接口IWebProxy

在PowerShell核心脚本中使用.NET核心接口IWebProxy,powershell,.net-core,Powershell,.net Core,我必须通过PowerShell Core检索internet代理服务器地址(跨平台),以便使用Invoke WebRequest-Uri-proxy命令 我想通过IWebProxy.GetProxy(URI)获取代理的URI 有没有办法在PowerShell核心脚本中使用.NET Core IWebProxy接口中的GetProxy()方法?您可以首先通过使用关键字导入命名空间: 使用名称空间System.Net 然后可以在该命名空间中创建类的实例: $obj1=新对象WebProxy 并调用他

我必须通过PowerShell Core检索internet代理服务器地址(跨平台),以便使用
Invoke WebRequest-Uri-proxy
命令

我想通过IWebProxy.GetProxy(URI)获取代理的URI


有没有办法在PowerShell核心脚本中使用.NET Core IWebProxy接口中的GetProxy()方法?

您可以首先通过
使用
关键字导入命名空间:

使用名称空间System.Net

然后可以在该命名空间中创建类的实例:

$obj1=新对象WebProxy

并调用他们的方法:

$obj1.GetProxy(“https://www.google.co.uk");

如果要将类从自定义dll导入PowerShell,可以使用
Add Type
cmdlet:

添加类型-Path“c:\mypath\my.dll”

您可以在