|
<HTML>
<HEAD>
<TITLE>デフォルトゲートウェイとIP アドレスの表示</TITLE>
</HEAD>
<BODY>
<%
ConnectString = "winmgmts:{impersonationLevel=impersonate}!root\cimv2"
Query = "SELECT IPAddress, DefaultIPGateway"
Query = Query & " FROM Win32_NetworkAdapterConfiguration"
Query = Query & " WHERE IPEnabled=TRUE"
On Error Resume Next
Set IPConfigSet = GetObject( ConnectString ).ExecQuery( Query )
if Err <> 0 Then
if Err.Number = -2147217405 then
Response.Write "Error 0x80041003: Access Denied: "
Response.Write "Check permissions and file security for this ASP file."
Response.Write "<BR>"
else
Response.Write "エラー説明: "
Response.Write Err.Description
Response.Write "エラー番号: "
Response.Write Err.Number
Response.Write "<BR>"
end if
end if
For each IPConfig in IPConfigSet
if Not IsNull(IPConfig.IPAddress) then
For i= LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
Response.Write "IP Address: "
Response.Write IPConfig.IPAddress(i) & "<br>"
Next
end if
if Not IsNull(IPConfig.DefaultIPGateway) then
For i= LBound(IPConfig.DefaultIPGateway) to _
UBound(IPConfig.DefaultIPGateway)
Response.Write "Default IP Gateway: "
Response.Write IPConfig.DefaultIPGateway(i) & "<br>"
Next
end if
Next
Response.Write "<BR>"
if Err <> 0 Then
Response.Write "エラー説明: "
Response.Write Err.Description
Response.Write "エラー番号: "
Response.Write Err.Number
Response.Write "<BR>"
end if
%>
</BODY>
</HTML>
| |