我有一个带有 powershell CA 的 Installshield 项目,它检查某个注册表项是否存在并根据结果设置属性。
手动执行脚本时注册表检查成功但失败(返回false
当从Installshield执行时。
** CA 在 UI 序列期间执行(在ExecuteAction
步骤) - 这是一个问题吗?
我该如何解决这个问题?是否有其他方法可以使用 powershell 自定义操作检查注册表项是否存在?
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
$keyName = "AutoAdminLogon"
if (Test-Path $registryPath)
{
# The following line returns FALSE when executed during installation and TRUE when executed manually.
$valueExists = (Get-ItemProperty $registryPath).PSObject.Properties.Name -contains $keyName
if ($valueExists)
{
# Set property to be read in installshield
Set-Property -Name IS_AUTO_LOGON -Value 2
}
else
{
Set-Property -Name IS_AUTO_LOGON -Value 1
}
}
无需使用 Powershell 执行此操作。 Windows 安装程序可以使用以下命令本地执行此操作注册定位器 https://msdn.microsoft.com/en-us/library/windows/desktop/aa371171(v=vs.85).aspx table.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)