+ Post New Thread
Results 1 to 10 of 10
Learning Network Manager Thread, Hardware Audit in Technical; Hi, I need to run a script on individual machines that'll not only tell me how much RAM said machines ...
  1. #1
    basicchannel's Avatar
    Join Date
    May 2010
    Location
    Norfolk, UK
    Posts
    279
    Thank Post
    36
    Thanked 22 Times in 14 Posts
    Blog Entries
    1
    Rep Power
    23

    Hardware Audit

    Hi,
    I need to run a script on individual machines that'll not only tell me how much RAM said machines have, but how much is loaded into each slot and which slots (if any) are free. I found a great VBscript written by a Microsoft scripting guy but its downside was that although it worked, every time the script was run it overwrote the CSV file it was writing into. Maybe I was using it incorrectly but I kinda gave up on that one. I have also tried with Spiceworks which tells you how much RAM a machine has, but no information about DIMM slots.

    Has anyone else had to do this? Could anyone suggest a way of doing this please? I'm learning Powershell atm so anything PS based would be a huge bonus.

    many thanks

  2. #2

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,272
    Thank Post
    613
    Thanked 1,567 Times in 1,407 Posts
    Rep Power
    412
    Perhaps post/link the one you've tried?

    Ben

  3. #3
    basicchannel's Avatar
    Join Date
    May 2010
    Location
    Norfolk, UK
    Posts
    279
    Thank Post
    36
    Thanked 22 Times in 14 Posts
    Blog Entries
    1
    Rep Power
    23
    attached script as .txt.

    Unfortunately I can't find where I downloaded it from so can't credit the guy.

    EDIT: This script currently resides as a startup script
    Attached Files Attached Files

  4. #4

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,272
    Thank Post
    613
    Thanked 1,567 Times in 1,407 Posts
    Rep Power
    412
    It looks good and probably just needs a tweak I assume you want all the computers to write to one log file that you can analyse?

    Ben

  5. #5
    Netman's Avatar
    Join Date
    Jul 2005
    Location
    56.343515, -2.804118
    Posts
    911
    Thank Post
    367
    Thanked 190 Times in 143 Posts
    Rep Power
    54

  6. #6


    Join Date
    Mar 2009
    Location
    Leeds
    Posts
    6,505
    Thank Post
    227
    Thanked 848 Times in 727 Posts
    Rep Power
    287
    have a script somewhere that records that BUT it dosent always do it accuraely sometimes wht the board reports via wmi is not correct

    Code:
    'On Error Resume Next
    ramsticks = ""
    strComputer = "."
    Set wshShell = WScript.CreateObject( "WScript.Shell" )
    ' Create the File System Object
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory")
    For Each objItem in colItems
    ramsticks = ramsticks & " , " & objItem.Capacity / 1073741824 & "gb"
    Next
     
     
    dim bankCount
    Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
     
    strWQL = "select * from Win32_MemoryDevice"
    Set objInstances = objWMI.ExecQuery(strWQL,,48)
     
    bankCount=0
    For Each objInstance in objInstances
      bankCount=bankCount+1
    Next
    wscript.echo ramsticks &  " , " & bankCount & " slots"
    ramdata = ramsticks &  " , " & bankCount & " slots"
    
    'write file location
    pcname = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
    strDirectory = "\\server\logs$\ram\"
    strFile = pcname & ".csv"
    
    ' Check that the strDirectory folder exists
    If objFSO.FolderExists(strDirectory) Then
       Set objFolder = objFSO.GetFolder(strDirectory)
    Else
       Set objFolder = objFSO.CreateFolder(strDirectory)
       'WScript.Echo "Just created " & strDirectory
    End If
    
    If objFSO.FileExists(strDirectory & strFile) Then
       Set objFolder = objFSO.GetFolder(strDirectory)
    Else
       Set objFile = objFSO.CreateTextFile(strDirectory & strFile)
       'Wscript.Echo "Just created " & strDirectory & strFile
    End If 
    
    set objFile = nothing
    set objFolder = nothing
    ' OpenTextFile Method needs a Const value
    ' ForAppending = 8 ForReading = 1, ForWriting = 2
    Const ForAppending = 2
    
    Set objTextFile = objFSO.OpenTextFile _
    (strDirectory & strFile, ForAppending, True)
    
    ' Writes result every time you run this VBScript
    objTextFile.WriteLine(ramdata)
    objTextFile.Close

  7. #7
    mmoseley's Avatar
    Join Date
    Apr 2007
    Location
    Birmingham
    Posts
    749
    Thank Post
    109
    Thanked 105 Times in 80 Posts
    Blog Entries
    2
    Rep Power
    43
    Spiceworks can do this too!

  8. #8
    basicchannel's Avatar
    Join Date
    May 2010
    Location
    Norfolk, UK
    Posts
    279
    Thank Post
    36
    Thanked 22 Times in 14 Posts
    Blog Entries
    1
    Rep Power
    23
    Thanks guys.
    It looks good and probably just needs a tweak I assume you want all the computers to write to one log file that you can analyse?
    Yeah that's right. I checked it again today and it seems to have stopped overwriting which is a good thing. It just seems a little temperamental.

    If Spiceworks can do this as a report can someone show me how? I know you can find out how many DIMM slots are occupied via the Spiceworks interface, but can this info be exported into a CSV?

  9. #9
    sdc
    sdc is offline
    sdc's Avatar
    Join Date
    Apr 2008
    Location
    Dorset, UK
    Posts
    310
    Thank Post
    53
    Thanked 42 Times in 37 Posts
    Rep Power
    41
    WinAudit v2.29 - Free Computer Audit Software
    This is what we use. I've written a script which runs the scan at startup only if it hasn't been run for this particular machine before. Each PC gets its audit logged to an individual CSV file (named after the PC) and if that CSV file exists, the audit doesn't run. The audit contains all hardware and software related to that PC. Plenty of command line options so you can tailor what it does to your requirements. Hope this helps.

  10. #10
    bencole's Avatar
    Join Date
    Nov 2013
    Posts
    76
    Thank Post
    45
    Thanked 2 Times in 2 Posts
    Rep Power
    2
    Google Project fog, set a server up on any machine (linux box) this is a web interface imaging system completely free and open source. it does much more than you need but this will list everything you need on every client computer. also install nedi and this will audit all your network stuff.

SHARE:
+ Post New Thread

Similar Threads

  1. Looking for tool to remotely audit hardware
    By morganw in forum Windows
    Replies: 10
    Last Post: 21st June 2010, 03:23 PM
  2. Hardware Audit
    By sLiDeR in forum Network and Classroom Management
    Replies: 15
    Last Post: 11th November 2008, 11:43 AM
  3. Hardware Audit
    By Mr_M_Cox in forum Windows
    Replies: 12
    Last Post: 4th June 2008, 12:51 PM
  4. Hardware & Software Audit erm software for education?
    By intrigue in forum How do you do....it?
    Replies: 7
    Last Post: 16th October 2007, 07:11 PM
  5. auditing hardware condition
    By david12345 in forum Hardware
    Replies: 3
    Last Post: 19th July 2007, 11:04 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •