A
Andreas Semmelmann
Hi Folks,
I ´ve created a Page the should query a remote Server via WMI. But if I
start the Page, I only get the information about my local PC. I´ve pasted
the code. Please look, If somebody could find an error.
<% @Import Namespace="System"%>
<% @Import Namespace="System.IO"%>
<% @Import Namespace="System.Management"%>
<script language="VB" runat="server">
Sub Page_Load(s as object, e as eventargs)
dim sServerPath as string = "\\computer\root\cimv2"
Dim conOptions As New ConnectionOptions()
conOptions.Authentication = AuthenticationLevel.Call
conOptions.Impersonation = ImpersonationLevel.Impersonate
conOptions.Username = "Domain\User"
conOptions.Password = "Password"
dim Scope as new ManagementScope(sServerPath,conOptions)
Scope.Connect()
Dim objectQuery As New ObjectQuery("select * from Win32_Bios")
Dim searcher As New ManagementObjectSearcher(objectQuery)
Dim share As ManagementObject
Dim BiosEntry As ManagementObject
For Each BiosEntry in searcher.Get()
response.write("Ser-Number: " & BiosEntry("SerialNumber"))
Next BiosEntry
End Sub
I ´ve created a Page the should query a remote Server via WMI. But if I
start the Page, I only get the information about my local PC. I´ve pasted
the code. Please look, If somebody could find an error.
<% @Import Namespace="System"%>
<% @Import Namespace="System.IO"%>
<% @Import Namespace="System.Management"%>
<script language="VB" runat="server">
Sub Page_Load(s as object, e as eventargs)
dim sServerPath as string = "\\computer\root\cimv2"
Dim conOptions As New ConnectionOptions()
conOptions.Authentication = AuthenticationLevel.Call
conOptions.Impersonation = ImpersonationLevel.Impersonate
conOptions.Username = "Domain\User"
conOptions.Password = "Password"
dim Scope as new ManagementScope(sServerPath,conOptions)
Scope.Connect()
Dim objectQuery As New ObjectQuery("select * from Win32_Bios")
Dim searcher As New ManagementObjectSearcher(objectQuery)
Dim share As ManagementObject
Dim BiosEntry As ManagementObject
For Each BiosEntry in searcher.Get()
response.write("Ser-Number: " & BiosEntry("SerialNumber"))
Next BiosEntry
End Sub