2017-07-31 67 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