WMI-Query of a Remote Machine

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top