2016-07-28 71 views
0

使用Get-Content,我开发了我的PowerShell脚本,但后来觉得要使用存储库用于模板。Powershell:如何从URI而不是本地磁盘获取JSON文件内容

$JsonContent = Get-Content $TFileUri | ConvertFrom-Json 

错误:

Get-Content : Cannot find drive. A drive with the name 'https' does not exist.

我试图加入-raw参数,管道到ConvertFrom JSON的之前就帮我在其他场合,但它给了我下面的错误:

$JsonContent = Get-Content $TFileUri -Raw | ConvertFrom-Json 

Get-Content : A parameter cannot be found that matches parameter name 'Raw.

如何从远程URI获取文件并解决上述问题?

回答

0

下适应帮我往前走(不知道如何的标准分辨率,但共享有一定的帮助)

$JsonContent = Invoke-RestMethod -Uri $TFileUri 

注:我没有觉得有必要转换JSON为对象,以及与上述线。

相关问题