【发布时间】:2010-12-15 13:37:45
【问题描述】:
我有一个简单的 powershell 脚本。它需要两个参数。两者都是采用字符串参数的方法 (Get-ResourcePool) 的一部分。
如果我在 Powershell 脚本中调用函数定义,像这样:
functName CI *FMS
效果很好。
Powershell 中的函数调用是(因为这个脚本将从外部调用):
FuncName $($args[0], $args[1])
我尝试从 Powershell 编辑器中调用它,在那里我安装了我需要的所有管理单元,如下所示:
C:\Script.ps1 A "*s"
其中 scrpt 是我的 .ps1 文件的名称。有一个功能。但是,这会失败,并显示参数为 null 或空的错误。
有什么想法吗?
编辑:
函数签名是:
函数 RevertToSnapshot($otherarg, $wildcard)
我在这里使用 $wildcard: $SearchString = [System.String]::Concat("*", $VM通配符) 名称 $SearchString(名称是 powercli 中 get-vm 的参数)。
【问题讨论】:
标签: powershell