1
我有一个powershell脚本,它使用'quser'命令来提取有关用户登录到一系列终端服务器的数据。从windows批处理脚本传递参数到powershell脚本
我想给输出文件添加一个时间戳,这个时间戳变量是在一个windows批处理文件中创建的,然后调用powershell脚本传递计算机名和时间戳,但powershell脚本与'Missing')'错误功能参数表”
param(
[CmdletBinding()]
[Parameter(ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[string[]]$ComputerName = 'localhost'
[string[]]$timestamp <========= this is the line I have added
)
如果我删除我添加的行(标注在上面的代码),脚本运行良好
谢谢:)大量Doh对我来说:( – nyehus
没问题。顺便说一句,错误信息应该显示你本地主机和'〜'在问题出现的地方(即逗号丢失的地方)。你使用ISE来编辑脚本,它在编辑器中显示一个红色的'〜'下划线,错误号是 – Duncan
没有看到 - 这是整个消息 - 'Missing')'在函数参数列表中。 在C:\ ts_users \ GET-LoggedOnUser.ps1:35焦炭:5 + <<<< [字符串] $时间戳 + CategoryInfo:ParserError:(CloseParenToken:TokenId)[],括号 tContainsErrorRecordException + FullyQualifiedErrorId:MissingEndParenthesisInFunctionParameterList ',我想<<<<表明错误的位置是 – nyehus