将参数从命令行传递到powershell

将参数从命令行传递到powershell,powershell,command-line,Powershell,Command Line,当我在命令行中运行以下命令时 powershell.exe "Import-Module ActiveDirectory;New-ADUser -name "rr" -path "OU=Test,DC=Example,DC=com" 我得到以下错误: New-ADUser : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Path'. Specified method i

当我在命令行中运行以下命令时

powershell.exe "Import-Module ActiveDirectory;New-ADUser -name "rr" 
-path "OU=Test,DC=Example,DC=com"
我得到以下错误:

New-ADUser : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Path'. Specified method is not supported.
At line:1 char:56
+ Import-Module ActiveDirectory;New-ADUser -name rr -path <<<<  OU=Test,DC=Example,DC=com
    + CategoryInfo          : InvalidArgument: (:) [New-ADUser], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.ActiveDirectory.Management.Commands.NewADUser
New ADUser:无法将“System.Object[]”转换为参数“Path”所需的类型“System.String”。不支持指定的方法。
第1行字符:56
+导入模块ActiveDirectory;新建ADUser-name rr-path尝试以下操作:

powershell.exe "Import-Module ActiveDirectory;New-ADUser -name 'rr' `
-path 'OU=Test,DC=Example,DC=com'"

非常感谢你。它做到了。谢谢你的帮助。