WbemScripting.SWbemLocator 개체를 사용하여 IIsWebServer의 Properties_ 속성을 열거하려고합니다. 내 목표는 PascalScript 코드를 사용하여 웹 사이트의 서버 바인딩을 검색하는 것입니다. VBScript를, 나는 다음과 같은 코드가 있습니다Inno 설치 열거 자
Dim site, binding, url
Set site = GetObject("IIS://localhost/W3SVC/1")
For Each binding In site.ServerBindings
url = binding
Exit For
Next
If Left(url, 1) = ":" Then
url = "localhost" & url
End If
If Right(url, 1) Then
url = Left(url, Len(url) - 1)
End If
Set site = Nothing
가 정확하지 않을 수 있으므로이 코드의 자유를 썼다을,하지만 비슷한 방식으로 PascalScript에서 할 싶습니다. 내가 붙어있는 부분은 ServerBindings를 통해 열거됩니다. 나는 그것을 작동시키기 위해 많은 일을 시도했으며, 나는 현재 다음과 같은 PascalScript를 가지고있다 :
function GetWebSites() : Array of String;
var
locatorObj, providerObj, nodeObj, appRoot: Variant;
props : String;
begin
locatorObj := CreateOleObject('WbemScripting.SWbemLocator');
providerObj := locatorObj.ConnectServer(GetComputerNameString(), 'root/MicrosoftIISv2');
nodeObj := providerObj.Get('IIsWebServer=''W3SVC/1''');
props := nodeObj.Properties_;
// How do I enumerate through the properties here? Or, my actual goal is from this point how do I get the ServerBindings (or the first element in the ServerBindings array)?
end; 어떤 도움을 주시면 감사하겠습니다
var e = new Enumerator(nodeObj.Properties_);
for (; ! e.atEnd(); e.moveNext()) {
var prop = e.item();
if (prop.Name == 'ServerBindings') {
// Do something
}
}
: 자바 스크립트에서
는 다음과 같은, 당신이해야 우리가 뭔가 ServerBindings를 얻을 수 있습니다. 고맙습니다.