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

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top