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