2013-04-02 74 views
2

當我在命令行中運行以下命令參數傳遞到PowerShell的

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 

回答

2

試試這個:

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

謝謝非常。它做到了。感謝你的幫助。 –