[英]Disabling Installshield's Next button with powershell
I have an Installshield project that uses powershell custom actions. 我有一个使用Powershell自定义操作的Installshield项目。 In one of my dialogs, I'm asking from the user to enter username and password, then I validate the credentials (with powershell) and I want to enable the
Next
button only if the credentials were correct. 在我的一个对话框中,我要求用户输入用户名和密码,然后验证凭据(使用powershell),并且仅在凭据正确时才启用“
Next
按钮。
Can this be achieved with powershell action item? Powershell操作项可以实现吗? The reason I'm using powershell is that I don't know InstallScript at all.
我使用Powershell的原因是我根本不了解InstallScript。
Here is my powershell script so far: 到目前为止,这是我的powershell脚本:
Function Test-UserCredential {
Param($username, $password)
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$ct = [System.DirectoryServices.AccountManagement.ContextType]::Machine, $env:computername
$opt = [System.DirectoryServices.AccountManagement.ContextOptions]::SimpleBind
$pc = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList $ct
$Result = $pc.ValidateCredentials($username, $password).ToString()
$Result
}
$comp_username = Get-Property -Name COMPUTER_USERNAME
$comp_password = Get-Property -Name COMPUTER_PASSWORD
$result = Test-UserCredential -username $comp_username -password $comp_password
if ($result)
{
#Enable "Next" button
}
else
{
#Disable "Next" button
}
Thanks. 谢谢。
There are three things you will have to do. 您将需要做三件事。
Note that for clarity of step 3's relevance, it can be useful to split this into two separate properties; 请注意,为清楚起见,将步骤3分为两个单独的属性可能很有用; set one in the powershell, reflect that into another in the Set Property control event, and have control conditions that read the latter.
在Powershell中设置一个,在Set Property控件事件中将其反映为另一个,并具有读取后者的控制条件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.