07-24-2023, 08:38 AM
i have a VBScript file. When its on the computer it works fine. I want to put it on a php site for it to be executed by a button click. but i have not been successful. it actually get computer info. hoping it will work on the users machine. any ideas will be appreciated. If or if anyone knows how to do it with jscript
Here is the code :
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colSettings
Wscript.Echo "OS Name: " & objOperatingSystem.Caption
Wscript.Echo "Version: " & objOperatingSystem.Version
Wscript.Echo "Available Physical Memory: " & _
objOperatingSystem.FreePhysicalMemory
Next
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
Wscript.Echo "Total Physical Memory: " & _
objComputer.TotalPhysicalMemory
Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colSettings= objWMIService.ExecQuery _
("SELECT * FROM Win32_DiskDrive")
For Each objItem In colSettings
WScript.Echo "Disk Size: " & objItem.Size
Next
Dim WSHShell
Dim objAdr
On error resume next
Set WSHShell = WScript.CreateObject("WScript.Shell")
test = wshshell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names")
If err.number > 0 Then
msgbox "SQL Server not found"
else msgbox "SQL Server found"
end if
Here is the code :
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colSettings
Wscript.Echo "OS Name: " & objOperatingSystem.Caption
Wscript.Echo "Version: " & objOperatingSystem.Version
Wscript.Echo "Available Physical Memory: " & _
objOperatingSystem.FreePhysicalMemory
Next
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
Wscript.Echo "Total Physical Memory: " & _
objComputer.TotalPhysicalMemory
Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colSettings= objWMIService.ExecQuery _
("SELECT * FROM Win32_DiskDrive")
For Each objItem In colSettings
WScript.Echo "Disk Size: " & objItem.Size
Next
Dim WSHShell
Dim objAdr
On error resume next
Set WSHShell = WScript.CreateObject("WScript.Shell")
test = wshshell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names")
If err.number > 0 Then
msgbox "SQL Server not found"
else msgbox "SQL Server found"
end if