注意函数中使用了“[ValidateCount(1,3)]”这句,这表示可以接受的参数个数是1-3之间,即1个、2个、3个都可以。但不能超了,也不能少了。 复制代码 代码如下: PS> Add-User -UserName "Tobias", "Nina" Adding Tobias Adding Nina PS> Add-User -UserName "Tobias", "Nina", "Cofi", "splaybow" Add-User : Cannot validate argument on parameter "UserName". The number of provided arguments, (4), exceeds the maximum number of allowed arguments (3). Provide fewer than 3 arguments, and then try the command again.