gpt4 book ai didi

powershell - 从命令行向Powershell传递参数

转载 作者:行者123 更新时间:2023-12-02 23:47:26 25 4
gpt4 key购买 nike

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

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

最佳答案

试试这个:

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

关于powershell - 从命令行向Powershell传递参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15760145/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com