ผมไปเจอที่เป็น VBScript ใช้กับ ASP น่ะครับ ไม่รู้ว่าจะใช้ได้หรือเปล่าครับ
Code (ASP)
<%
Set pc = CreateObject("Wscript.Network")
response.write pc.ComputerName
Set pc = nothing
response.write " (currently connected as "
response.write ucase(Request.ServerVariables("SERVER_NAME"))
response.write " on "
response.write Request.ServerVariables("LOCAL_ADDR") & ")"
%>
Code (ASP)
<%
Set Loc = createobject("WBEMScripting.SWBEMLocator")
Set nms = Loc.ConnectServer()
WQL = "SELECT CSName FROM Win32_OperatingSystem"
Set cs = nms.ExecQuery(WQL, "WQL", 48)
For Each pc In cs
Response.Write pc.CSName
Next
set cs = nothing: set nms = nothing: set loc = nothing
%>
Code (ASP)
<%
set conn = CreateObject("ADODB.Connection")
conn.open "<connectionString>"
set rs = conn.execute("SELECT @@SERVERNAME")
response.write rs(0)
rs.close: set rs = nothing
conn.close: set conn = nothing
%>
dim cOperation,cService,cComputerName,cSystemmodel,cTotalPhysical,cProcessor
dim objfso,objtextfile
set objfso=CreateObject("Scripting.FileSystemObject")
set objtextfile=objfso.OpenTextFile("D:\OK.csv",8,True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
cOperation = objOperatingSystem.Caption & " " & objOperatingSystem.Version
cService = objOperatingSystem.ServicePackMajorVersion & "." & objOperatingSystem.ServicePackMinorVersion
Next
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
cComputerName = objComputer.Name
cSystemmodel = objComputer.Model
cTotalphysical = objComputer.TotalPhysicalMemory
Next
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_Processor")
For Each objProcessor in colSettings
cProcessor = objProcessor.Name
Next
Set colAdapters = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objAdapter in colAdapters
cNetworkAdapter = objAdapter.Description
cMACAddress = objAdapter.MACAddress
If Not IsNull(objAdapter.IPAddress) Then
For i = 0 To UBound(objAdapter.IPAddress)
cIPAddress = objAdapter.IPAddress(i)
Next
End If
Next
objtextfile.writeline(cOperation & "," & cService & "," & cComputerName & "," & cSystemmodel & _
"," & cTotalPhysical & "," & cProcessor & "," & cNetworkAdapter & "," & cMACAddress & _
"," & cIPAddress )