473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Inventory in ASP.

Hi,
I m new to ASP. I have written a script to take inventory of PCs on my
network in an excel spreadsheet. I want it to be available whenever
wherever needed by my managers and other accounts/purchase people. Is
there any way possible that I can put it on my intranet website using
ASP...????
Thanx in advance....
Jaydeep.
Script Code goes here.
'--------------------------------------------------------------------------*-------------------------------

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
x = 1
For i = 1 To 15
objExcel.Cells(x, i).Font.Bold = True
Next
objExcel.Cells(1, 1).Value = "Machine Name"
objExcel.Cells(1, 2).Value = "# of Procs"
objExcel.Cells(1, 3).Value = "Proc Type"
objExcel.Cells(1, 4).Value = "Max Clock Speed"
objExcel.Cells(1, 5).Value = "Tot Phy Mem"
objExcel.Cells(1, 6).Value = "Free Phy Mem"
objExcel.Cells(1, 7).Value = "Tot Virtual Mem"
objExcel.Cells(1, 8).Value = "Free Virtual Mem"
objExcel.Cells(1, 9).Value = "Tot Visible Mem"
objExcel.Cells(1, 10).Value = "Manufacturer"
objExcel.Cells(1, 11).Value = "Model"
objExcel.Cells(1, 12).Value = "OS Serial Number"
objExcel.Cells(1, 13).Value = "Machine Serial Number"
objExcel.Cells(1, 14).Value = "Free Space"
objExcel.Cells(1, 15).Value = "File System"
objExcel.Cells(1, 16).Value = "Device ID"
''''''''''''''''''
x = 2
strComputers = InputBox _
("What computer would you like info on?", _
"Inventory.", strLocalComputer)
On Error Resume Next
Set objNetwork = CreateObject("Wscript.Network")
strLocalComputer = objNetwork.ComputerName
If strComputers = "" Then
WScript.Quit
End If
'''''''
arrComputers = Split(strComputers, " ")
For Each strComputer In arrComputers
objExcel.Cells(x, 1).Value = strComputer
x = x + 1
y = x - 1
''''''''''''''
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colCSes = objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem")
For Each objCS In colCSes
objExcel.Cells(y, 2).Value = objCS.NumberOfProcessors
Next
Set colProcessors = objWMIService.ExecQuery("Select * from
Win32_Processor")
For Each objProcessor In colProcessors
objExcel.Cells(y, 3).Value = objProcessor.Name
objExcel.Cells(y, 4).Value = objProcessor.MaxClockSpeed
Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colCSItems = objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem")
For Each objCSItem In colCSItems
objExcel.Cells(y, 5).Value = objCSItem.TotalPhysicalMemory
Next
Set colOSItems = objWMIService.ExecQuery("SELECT * FROM
Win32_OperatingSystem")
For Each objOSItem In colOSItems
objExcel.Cells(y, 6).Value = objOSItem.FreePhysicalMemory
objExcel.Cells(y, 7).Value = objOSItem.TotalVirtualMemorySize
objExcel.Cells(y, 8).Value = objOSItem.FreeVirtualMemory
objExcel.Cells(y, 9).Value = objOSItem.TotalVisibleMemorySize
Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem")
For Each objItem In colItems
objExcel.Cells(y, 10).Value = objItem.Manufacturer
objExcel.Cells(y, 11).Value = objItem.Model
Next
Set colOperatingSystems = objWMIService.ExecQuery("Select * from
Win32_OperatingSystem")
For Each objOperatingSystem In colOperatingSystems
objExcel.Cells(y, 12).Value = objOperatingSystem.SerialNumber
Next
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS")
For Each objItem In colItems
objExcel.Cells(y, 13).Value = objItem.SerialNumber
Next
Const CONVERSION_FACTOR = 1048576
Set colItems = objWMIService.InstancesOf("SELECT * FROM
Win32_LogicalDisk")
For Each objItem In colItems
FreeMegaBytes = objItem.FreeSpace / CONVERSION_FACTOR
objExcel.Cells(y, 14).Value = objItem.FreeMegaBytes
objExcel.Cells(y, 15).Value = objItem.FileSystem
objExcel.Cells(y, 16).Value = objItem.DeviceID
Next

Jan 21 '06 #1
1 1494
You can write excel content to Response to show excel file on broswer:

Response.ContentType = "application/vnd.ms-excel";
Response.Buffer = true;
Response.AddHeader("Content-Disposition", "inline;filename=" + ExcelFileName);
Response.WriteFile(ExcelFilePath + ExcelFileName);
Response.End();

HTH

Elton Wang
"ja*************@gmail.com" wrote:
Hi,
I m new to ASP. I have written a script to take inventory of PCs on my
network in an excel spreadsheet. I want it to be available whenever
wherever needed by my managers and other accounts/purchase people. Is
there any way possible that I can put it on my intranet website using
ASP...????
Thanx in advance....
Jaydeep.
Script Code goes here.
'--------------------------------------------------------------------------Â*-------------------------------

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
x = 1
For i = 1 To 15
objExcel.Cells(x, i).Font.Bold = True
Next
objExcel.Cells(1, 1).Value = "Machine Name"
objExcel.Cells(1, 2).Value = "# of Procs"
objExcel.Cells(1, 3).Value = "Proc Type"
objExcel.Cells(1, 4).Value = "Max Clock Speed"
objExcel.Cells(1, 5).Value = "Tot Phy Mem"
objExcel.Cells(1, 6).Value = "Free Phy Mem"
objExcel.Cells(1, 7).Value = "Tot Virtual Mem"
objExcel.Cells(1, 8).Value = "Free Virtual Mem"
objExcel.Cells(1, 9).Value = "Tot Visible Mem"
objExcel.Cells(1, 10).Value = "Manufacturer"
objExcel.Cells(1, 11).Value = "Model"
objExcel.Cells(1, 12).Value = "OS Serial Number"
objExcel.Cells(1, 13).Value = "Machine Serial Number"
objExcel.Cells(1, 14).Value = "Free Space"
objExcel.Cells(1, 15).Value = "File System"
objExcel.Cells(1, 16).Value = "Device ID"
''''''''''''''''''
x = 2
strComputers = InputBox _
("What computer would you like info on?", _
"Inventory.", strLocalComputer)
On Error Resume Next
Set objNetwork = CreateObject("Wscript.Network")
strLocalComputer = objNetwork.ComputerName
If strComputers = "" Then
WScript.Quit
End If
'''''''
arrComputers = Split(strComputers, " ")
For Each strComputer In arrComputers
objExcel.Cells(x, 1).Value = strComputer
x = x + 1
y = x - 1
''''''''''''''
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colCSes = objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem")
For Each objCS In colCSes
objExcel.Cells(y, 2).Value = objCS.NumberOfProcessors
Next
Set colProcessors = objWMIService.ExecQuery("Select * from
Win32_Processor")
For Each objProcessor In colProcessors
objExcel.Cells(y, 3).Value = objProcessor.Name
objExcel.Cells(y, 4).Value = objProcessor.MaxClockSpeed
Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colCSItems = objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem")
For Each objCSItem In colCSItems
objExcel.Cells(y, 5).Value = objCSItem.TotalPhysicalMemory
Next
Set colOSItems = objWMIService.ExecQuery("SELECT * FROM
Win32_OperatingSystem")
For Each objOSItem In colOSItems
objExcel.Cells(y, 6).Value = objOSItem.FreePhysicalMemory
objExcel.Cells(y, 7).Value = objOSItem.TotalVirtualMemorySize
objExcel.Cells(y, 8).Value = objOSItem.FreeVirtualMemory
objExcel.Cells(y, 9).Value = objOSItem.TotalVisibleMemorySize
Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem")
For Each objItem In colItems
objExcel.Cells(y, 10).Value = objItem.Manufacturer
objExcel.Cells(y, 11).Value = objItem.Model
Next
Set colOperatingSystems = objWMIService.ExecQuery("Select * from
Win32_OperatingSystem")
For Each objOperatingSystem In colOperatingSystems
objExcel.Cells(y, 12).Value = objOperatingSystem.SerialNumber
Next
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS")
For Each objItem In colItems
objExcel.Cells(y, 13).Value = objItem.SerialNumber
Next
Const CONVERSION_FACTOR = 1048576
Set colItems = objWMIService.InstancesOf("SELECT * FROM
Win32_LogicalDisk")
For Each objItem In colItems
FreeMegaBytes = objItem.FreeSpace / CONVERSION_FACTOR
objExcel.Cells(y, 14).Value = objItem.FreeMegaBytes
objExcel.Cells(y, 15).Value = objItem.FileSystem
objExcel.Cells(y, 16).Value = objItem.DeviceID
Next

Jan 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: gregork | last post by:
I have painstakingly created an excel 2000 workbook for the very complex recipes I have to formulate. I have 2 sheets- 1 for configuring the recipe and 1 that is like an inventory of all the raw...
2
by: Stella Pieters via AccessMonster.com | last post by:
Let me start by saying that I'm a newbie in VBA. I've created an application in access where the user enters the quantity of the items sold in a form. I would like to have these records created...
13
by: royaltiger | last post by:
I am trying to copy the inventory database in Building Access Applications by John L Viescas but when i try to run the database i get an error in the orders form when i click on the allocate...
109
by: zaidalin79 | last post by:
I have a java class that goes for another week or so, and I am going to fail if I can't figure out this simple program. I can't get anything to compile to at least get a few points... Here are the...
0
by: south622 | last post by:
I'm taking a beginning Java course and I'm stuck in week eight of a nine week course. If anyone could help me I would greatly appreciate it. This assignment was due yesterday and each day I go past...
9
by: xxplod | last post by:
I am suppose to modify the Inventory Program so the application can handle multiple items. Use an array to store the items. The output should display the information one product at a time, including...
3
by: cblank | last post by:
I need some help if someone could help me. I know everyone is asking for help in java. But for some reason I'm the same as everyone else when it comes to programming in java. I have an inventory...
2
by: pinkf24 | last post by:
I cannot figure out how to add the following: Modify the Inventory Program to include an Add button, a Delete button, and a Modify button on the GUI. These buttons should allow the user to perform...
1
by: jcato77 | last post by:
I need help with a class project I'm working on, Below is my assignment and the code I have currently created. Assignment: Modify the Inventory Program by creating a subclass of the product class...
3
by: 100grand | last post by:
Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.