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