A
Andreas Semmelmann
Hello.
I´ve following Problem. I try to use WMI in an ASP.NET Site. But I get still
this error:
Server Error in '/ServerMon' Application.
----------------------------------------------------------------------------
----
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'ConnectionOptions' is not defined.
Source Error:
Line 1: Dim Options As New ConnectionOptions()
Source File: D:\Inetpub\wwwroot\ServerMon\Default.aspx Line: 1
How must i define the Connection Options. I´ve declared it! See below. I´m
new to ASP.NET/VB.NET.
I used the following Code:
<%@ Page Language="VB" %>
<%@ Import Namespace=System.Diagnostics %>
<script runat="server">
Sub Page_Load(Sender as Object, e as EventArgs)
Dim Options As New ConnectionOptions()
options.Username = "dom\user"
options.Password = "password"
Dim Scope As New ManagementScope("\\mcntr2\root\cimv2", options)
Dim strSVCquery As String =
ConfigurationSettings.AppSettings("NICquery")
Dim objNICQuery As New wqlObjectQuery(strSVCquery)
Dim objNICsearcher As New ManagementObjectSearcher(scope, objNICQuery)
Dim envVar As New ManagementObject()
Dim objNICItem As PropertyData
Dim strNICColName As String
scope.connect
For Each envVar in objNICSearcher.Get
For Each objNICItem in envVar.Properties
strNICColName = objNICItem.Name
Next
Next
End Sub
I´ve following Problem. I try to use WMI in an ASP.NET Site. But I get still
this error:
Server Error in '/ServerMon' Application.
----------------------------------------------------------------------------
----
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'ConnectionOptions' is not defined.
Source Error:
Line 1: Dim Options As New ConnectionOptions()
Source File: D:\Inetpub\wwwroot\ServerMon\Default.aspx Line: 1
How must i define the Connection Options. I´ve declared it! See below. I´m
new to ASP.NET/VB.NET.
I used the following Code:
<%@ Page Language="VB" %>
<%@ Import Namespace=System.Diagnostics %>
<script runat="server">
Sub Page_Load(Sender as Object, e as EventArgs)
Dim Options As New ConnectionOptions()
options.Username = "dom\user"
options.Password = "password"
Dim Scope As New ManagementScope("\\mcntr2\root\cimv2", options)
Dim strSVCquery As String =
ConfigurationSettings.AppSettings("NICquery")
Dim objNICQuery As New wqlObjectQuery(strSVCquery)
Dim objNICsearcher As New ManagementObjectSearcher(scope, objNICQuery)
Dim envVar As New ManagementObject()
Dim objNICItem As PropertyData
Dim strNICColName As String
scope.connect
For Each envVar in objNICSearcher.Get
For Each objNICItem in envVar.Properties
strNICColName = objNICItem.Name
Next
Next
End Sub