Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/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 旋度的幂壳等价物http://www.example.com/script.sh |bash-s<;争论>;_Powershell_Amazon Web Services_Arguments_User Data - Fatal编程技术网

Powershell 旋度的幂壳等价物http://www.example.com/script.sh |bash-s<;争论>;

Powershell 旋度的幂壳等价物http://www.example.com/script.sh |bash-s<;争论>;,powershell,amazon-web-services,arguments,user-data,Powershell,Amazon Web Services,Arguments,User Data,如何在带参数的PowerShell中运行远程脚本。 对于linux,我使用的是curlhttp://www.example.com/script.sh |bash-s PowerShell中是否有类似的等效程序 用例:AmazonEC2的用户数据脚本 谢谢你经常会发现这样的例子: iex (New-Object System.Net.WebClient).DownloadString('http://domain/script.ps1') (在某些其他语言中,可以将其看作是exec或eval)

如何在带参数的PowerShell中运行远程脚本。 对于linux,我使用的是
curlhttp://www.example.com/script.sh |bash-s

PowerShell中是否有类似的等效程序

用例:AmazonEC2的用户数据脚本


谢谢

你经常会发现这样的例子:

iex (New-Object System.Net.WebClient).DownloadString('http://domain/script.ps1')
(在某些其他语言中,可以将其看作是
exec
eval


剩下的部分是创建一个,它有一个方法来下载URL的内容并将其作为字符串返回。

谢谢@briantist,我可以传递像
这样的参数吗bash-s
@Shan我不这么认为,但是您可以通过从下载的字符串创建一个
[ScriptBlock]
,然后使用
Invoke Command-ArgumentList
来执行它,但是必须编写脚本才能使用这些参数。明白了,谢谢您使用
&{param()…这里的整个脚本}
。仍然不确定如何管理重新启动以更改windows中的主机名