使用Autologon.exe的Powershell命令行

时间:2017-03-11 20:45:02

标签: powershell windows-10

是否有人使用PowerShell v5.1使用'Autologon.exe for Windows v3.10'?

执行1:

以管理员身份运行以下命令:

.\Autologon.exe guest10 test.com Password1

错误1:

enter image description here

执行2:

作为powershell中的管理员,运行以下命令:

$obj=.\Autologon.exe
        $name ="guest10"
        $domain="test"
        $pass="Password1"
        & $obj $name $domain $pass

错误2:没有任何事情发生

执行3:

作为powershell中的管理员,运行以下命令:

{
    "rules": {
        ".read": "auth != null",
        ".write": "auth != null",
        "settings": {
            "app": {
                ".read": true,
                ".write": false
            }
        }
    }
}

误差3:

  

'&'之后的表达在管道元素中生成了一个无效的对象。它必须导致命令名称,脚本块或CommandInfo对象。

2 个答案:

答案 0 :(得分:1)

我通常使用Start-ProcessArgumentList参数来运行带参数的程序:

$autologon = "C:\folder\Autologon.exe"
$username = "guest10"
$domain = "domain"
$password = "Password1"

Start-Process $autologon -ArgumentList $username,$domain,$password

或者您可以将它们直接放入命令中:

Start-Process "C:\folder\Autologon.exe" -ArgumentList "guest10","domain","Password1"

答案 1 :(得分:1)

这对我有用:

Start-Process -FilePath $exePath -ArgumentList "/accepteula", $user, $domain, $password -Wait

对于报价展示非常挑剔。

相关问题