0

我正在尝试使用儿童运行手册进行 POC。作为此 POC 的一部分,我创建了一个简单的运行手册 Child.ps1,其中包含以下内容:

Param(
    [string]$FolderPath
)
$path = $FolderPath
if(! (Test-Path $path))
{
    New-Item -Type dir -Path $path
    Write-Output "Created directory '$path'"
}
else
{
    Write-Output "Directory '$path' already exists"
}

和一个父 Runbook,它通过传递参数调用子 Runbook,如下所示:

.\Child.ps1 -FolderPath "C:\TestPath"

当我测试父 Runbook 时,我收到以下错误:

.\Child.ps1 : The term '.\Child.ps1' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try 
again.
At line:1 char:1
+ .\Child.ps1 -FolderPath "C:\TestPath"
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (.\Child.ps1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我正在尝试使用 Hybrid Worker 对此进行测试。我能够成功测试子运行手册。任何想法为什么会失败。我在这里遗漏了什么吗?

4

1 回答 1

1

一般来说,这应该有效。但是,如果未发布子 Runbook,您可能会收到此错误消息。出版了吗?

于 2018-04-11T17:42:26.160 回答