Inventory in ASP.

Discussion in 'ASP .Net' started by jaydeep.kubavat@gmail.com, Jan 21, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. 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


    "" 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
    >
    >
    =?Utf-8?B?RWx0b24gVw==?=, Jan 21, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Tuman

    directory inventory

    David Tuman, Feb 10, 2004, in forum: C++
    Replies:
    3
    Views:
    416
    Christoph Rabel
    Feb 10, 2004
  2. lalalala

    inventory databasing

    lalalala, May 26, 2006, in forum: Java
    Replies:
    1
    Views:
    797
    IchBin
    May 26, 2006
  3. Lisa Fong
    Replies:
    0
    Views:
    339
    Lisa Fong
    Feb 16, 2007
  4. =?Utf-8?B?UGF1bCBCdXp6YSwgb2xkc3RlciB1c2luZyBuZXcg

    Print Label on LOCAL Zebra Printer from WEBSITE Inventory DB

    =?Utf-8?B?UGF1bCBCdXp6YSwgb2xkc3RlciB1c2luZyBuZXcg, Apr 25, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    1,363
    Alexey Smirnov
    Apr 26, 2007
  5. jay_kbvt

    Inventory in ASP

    jay_kbvt, Jan 21, 2006, in forum: ASP General
    Replies:
    2
    Views:
    351
Loading...

Share This Page