Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

starting a VBS script server side from a asp page

Status
Not open for further replies.

boostaz1

Programmer
Aug 26, 2003
7
0
0
US
I have a script which monitors the free disk space on all my w2k servers and outputs the data to my sql server. I currently have it set up on a schedule. However I would also like to start the script server side from a web page any ideas.
As always here is my code use it freely.
Dim strStatus
Dim pstatus
Dim Connect
Dim objWMIService, objSystem, a
Dim ColSystem, sManufacturer, sSystemtype, sSystemName, sBiosRev
Dim sServiceTag, sAssetTag, subnet


On Error Resume Next
Set conn = WScript.CreateObject("ADODB.Connection")
Connect="Driver={SQL Server};Server=;Database=;UID=;PWD="
conn.Open connect
Set rs1 = WScript.CreateObject("ADODB.Recordset")
Set rs = WScript.CreateObject("ADODB.Recordset")
sql1 = "SELECT * FROM tblscanserver order by fldserver asc"
rs1.open sql1, conn, 3, 3
sql = "DELETE FROM tblserverspace"
rs.open sql, conn, 3, 3
Do until rs1.eof
Call GetInfo(rs1.fields("fldserver"))
rs1.movenext
Loop
rs1.close

'====================================================================================================
Function GetInfo(IPAddress)

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,AuthenticationLevel=pktprivacy}\\" & IPAddress & "\root\cimv2")
If Err.Number = 0 Then
Set ColSystem=objWMIService.execquery ("Select * from Win32_LogicalDisk where mediatype=12")



For Each objSystem In colSystem
sql = "SELECT * FROM tblserverspace"
rs.open sql, conn, 3, 3
rs.addnew
rs.fields("fldtimestamp") = Now()
rs.fields("fldserver") = objsystem.systemname
rs.fields("flddisk") = objsystem.caption
rs.fields("flddsksize") = objsystem.size
rs.fields("fldfreespace") = objsystem.freespace
rs.fields("flddiskID") = objsystem.filesystem
rs.update
rs.close
Next
Else
Err.clear
End If

End Function
 
Don't know if this hopefully might help at all:

Launch instance of an app with Windows Scripting Host inside an ASP Page - 5/11/2001

WshShell
Scott Mitchell - 5/14/2001 4:07:58 PM

4GuysFromRolla.com : ASP FAQS : The Nature of Things
Question: How can I call an executable program from my ASP page? by Bill Wilkinson - 10/17/2000

Executing Applications on a Server Through an ASP Page
Example: Getting Latest Versions From VSS [Micorsoft Visual Source Safe] by Neema Moraveji - 7/21/1999

How to Ping Using ASP by Bart Silverstein - 10/29/1998
This uses Windows Scripting Host to run a batch file on the server.


Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top