gpt4 book ai didi

powershell - 将 'az vm run-command' 与 .ps1 文件一起使用

转载 作者:行者123 更新时间:2023-12-03 00:44:27 25 4
gpt4 key购买 nike

我的 az vm run-command 存在问题。

我已经让它内联工作,如下所示:

$resource_name="winsecagentdev2"
$resource_group="russellmccloydev"

和:

az vm run-command invoke `
-g "${resource_group}" `
-n "${resource_name}" `
--command-id 'RunPowerShellScript' `
--scripts "Write-Output 'testing russ'"

它有效。

但是当我尝试使用 .ps1 文件时:

az vm run-command invoke `
-g "${resource_group}" `
-n "${resource_name}" `
--command-id 'RunPowerShellScript' `
--scripts @{'hello.ps1'} `
--parameters @{ "test" = "russell" }

我遇到这个问题:

Enter image description here

文档是这样说的:

Enter image description here

所以我有点陷入困境。

最佳答案

您可以尝试将文件放入以下格式:--脚本“@hello.ps1”`

Screenshot

hello.ps1

关于powershell - 将 'az vm run-command' 与 .ps1 文件一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51509324/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com