2017-07-31 68 views
0

我正在处理窗口应用程序。我正在使用installshield为此应用程序创建安装程序。直到那么一切工作正常,我可以在任何机器上安装设置。使用特定计算机域的installshield创建设置仅

问题:

出于安全原因,我想限制我的设置为特定的域仅在即我的组织假设我们使用的是aaa.com域,那么这个安装程序将只能够在这一领域执行。

如果您需要更多信息,请让我知道。

+0

在安装之前,您可能会在注册表中检查域吗? – XAMlMAX

+1

好吧,我正在调查你的答案,并让你知道它是否会工作.. – Sunny

回答

0

这是您可以选择的选项之一。
要从注册表中获取域名将为您完成这项工作。
我还没有使用InstallShield达到这个程度,但我发现this link解释的方法。
对于我张贴从代码中引用说,网站在这里:

Public blnResult 
Public strDomain 
Public strFQDomain 
Public objRootDSE 

blnResult = BindToAD 
If Not blnResult Then 
WScript.Quit(False) 
End If 

Function BindToAD() 
Dim blnResult_Bind 

BindToAD = False 

On Error Resume Next 
Set objRootDSE = GetObject("LDAP://RootDSE") 
If (Err.Number <> 0) Then 
Exit Function 
End If 

strDomain = objRootDSE.Get("DefaultNamingContext") 
If (Err.Number <> 0) Then 
Exit Function 
End If 

'// Shouldn't ever be true if no error was returned, but... 
If Len(strDomain) = 0 Then 
Exit Function 
End If 

blnResult_Bind = GetFQDNFromNamingContext(strDomain, strFQDomain) 
If blnResult_Bind Then 
BindToAD = True 
Else 
If (Err.Number <> 0) Then 
Exit Function 
End If 
End If 

On Error Goto 0 
End Function 


'// --------------------------------------------------------------------------------- 
'// GetFQDNFromNamingContext 
'// Purpose: Converts a Naming Context into a DNS name 
'// Input: strNamingContext e.g. DC=Domain,DC=Company,DC=com 
'// Output: FQDN for strNamingContext e.g. Domain.Company.com 
'// Returns: True/False 
'// 
'// Notes: LDAP allows for commas in strings, as long as they are escaped with a \ character. 
'// e.g. "CN=Lewis\, Chris" 
'// Since commas are not allowed in domain names, there is no parsing for them here. 
'// --------------------------------------------------------------------------------- 
Function GetFQDNFromNamingContext(ByVal strNamingContext, ByRef strFQDN) 
Dim arrDomain 
Dim intCount 
Dim strTemp 

GetFQDNFromNamingContext = False 

'// Parse the NC by creating an array with the comma as an array boundry 
arrDomain = Split(strNamingContext, ",") 

For intCount = 0 To UBound(arrDomain) 
'// Add a "." if needed 
If Len(strTemp) > 0 Then 
strTemp = strTemp & "." 
End If 

'// Remove the "DC=" and add this item to the temp string 
strTemp = strTemp & Mid(arrDomain(intCount), 4) 
Next 

strTemp = Replace(strNamingContext,"DC=","") 
strTemp = Replace(strTemp,",",".") 

'// Return the FQDN 
GetFQDNFromNamingContext = True 
strFQDN = strTemp 
End Function 
0

基本上需要用自定义动作的设置早起域名,设置属性,然后使用该属性在发射条件。这有有关获取当前域名几个答案:

Get the domain name of a computer from Windows API

然而,这是一种考验,往往效果更好的应用。安装时测试意味着用户无法安装,然后加入域并运行应用程序。这也意味着用户可以加入域名,安装应用程序,然后离开域名(甚至可以将笔记本电脑带回家)并继续运行该应用程序。那么你提到的“安全原因”是什么?如果域成员资格是应用程序的要求,则将运行时检查添加到应用程序,并让安装发生在任何地方。

+0

感谢@PhilDW为您的答复。那么设置安全性的最佳方式是只有经过授权的成员才能安装或使用。随时欢迎您提出宝贵的意见和建议。 – Sunny

+0

我的建议是将域名检查放在应用程序中,原因是我提到的,链接显示了要使用的代码类型。 – PhilDW