交互式Powershell脚本返回登录帐户有效性值

时间:2016-09-05 14:36:37

标签: powershell active-directory

Function Test-ADAuthentication {
param($username,$password)
(new-object directoryservices.directoryentry "",$username,$password).psbase.name -ne $null

}

    $username = read-host "Please Enter Username";
    $password = read-host "Please Enter Password" -assecurestring;



        Test-ADAuthentication $username $password;

                Start-Sleep -s 5

有人知道为什么顶部的这个功能可以自己运行但是在运行时如上所述不起作用?我猜它是事物执行的顺序,我怎样才能更改变量以便首先获得输入信息以获得正确的布尔结果?

提前致谢

0 个答案:

没有答案