@triggmeister, the reason your script won't work is this line:
Code:
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") What it's trying to do is to connect to the remote computer using the credentials of the user running the web page - this will vary depending on the version of IIS but it's almost certainly not going to be a user with admin rights!
What you can do if you want to go down this route is to specify credentials for a user who is able to connect:
Code:
<%
sComputer = "ma613-03"
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer _
(sComputer, "root\cimv2", "domain\username", "ReallySecretPassword")
objSWbemServices.Security_.ImpersonationLevel = 3
Set colComputer = objSWbemServices.ExecQuery("Select * from Win32_ComputerSystem")
sUser="Free"
For Each objComputer in colComputer
if objComputer.UserName<>"" then sUser=objComputer.UserName
next
response.write sUser
%> This connects to the machine with credentials and then does your query. I've added a bit to it to cope with no user logged on - that may not be important!
The benefit of a method like this is that it's "live" - you're not relying on a database which could be out of date but the downside is that it takes a little while for the web page to query each computer, particularly if any machines are switched off or restarting etc.