ProLiant Servers (ML,DL,SL)
1821541 Members
2460 Online
109633 Solutions
New Discussion юеВ

Script to inventory hardware?

 
Paul_637
Regular Advisor

Script to inventory hardware?

In the absence of a HP SIM install (I don't think there's an install here) is there any way of scripting a WMI or similar script to query all servers (assuming HP agents are installed) to identify physical disk info?

I'm looking to do a count of all physical disks & ideally capacity across the server estate (100+ servers) so I can report on numbers & overall raw capacity.

I know I can query logical disk info/space etc. but it's the underlying hardware I'm after...

Any pointers would be appreciated!
9 REPLIES 9
Diego Castelli
Trusted Contributor

Re: Script to inventory hardware?

If i understand correctly you want to interrogate each disk and create a report for each server with free-space, i'm right?

i have the script 4 you:
!!!!!! diskusage.vbs FILE START !!!!!!!!!
Const HARD_DISK = 3
strComputer = WScript.Arguments.Item(0)
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")
For Each objDisk in colDisks
Wscript.Echo "DeviceID: "& vbTab & objDisk.DeviceID
Wscript.Echo "Free Disk Space: "& vbTab & Round(objDisk.FreeSpace / 1048576) & " MB
" & vbCrLf
Next

!!!!!! diskusage.vbs FILE END !!!!!!!!!



If you have FULL WMI access from the network to the servers, you can:

1) generate a simple text list of servers that you want to monitor.

2) for each server in the list (you can iterate with a loop, if u want, see "*** section" later), launch that command:
cscript /NoLogo diskusage.vbs > \hostname_rpt.txt


** section. ONLY IF YOU DON'T HAVE FULL WMI ACCESS FROM NET:

correct diskusage.vbs second line as follows:
strComputer = "."
then schedule it to run ON THE SERVERS YOU WANT TO REPORT FOR.
BUT, create a network share on your mgmt_server and point the at that share.


*** section. How to iterate automatically from a simple text list:

!!!!!!!! all_srv_rpt.bat FILE START !!!!!!!!

@ECHO OFF
For /F "usebackq delims=; tokens=1,*" %%a IN ("list_of_servers.txt") DO(
cscript /NoLogo diskusage.vbs %%a > \%%a_rpt.txt
)

!!!!!!!! all_srv_rpt.bat FILE END !!!!!!!!

PLACE THIS FILE IN THE SAME DIR OF THE VBS (OBV.LY...) OR TYPE THE FULL PATH OF IT INSIDE THIS.



**** section. You want to report more details 'bout disks.

take a look AT the object properties here:
http://msdn.microsoft.com/en-us/library/aa394173(VS.85).aspx

and then modify the VBS adding lines like the objDisk.FreeSpace, deleting the round function around it and substituting FreeSpace with the property name that you want to report.

-------------------------------------------------

I sincerely hope this helps you (it took 'bout half an hour for me to write it....)

Bye.
Diego C.

MS MCSA Server 2003

HP Accredited Integration Specialist
Paul_637
Regular Advisor

Re: Script to inventory hardware?

Although I really appreciate your efforts, I'm sorry but that's not quite what I'm after :)

I'm looking to capture info relating to physical disks - i.e. what disks are installed into the server chassis, regardless of logical disks configured on them. I've already got scripts to capture free space etc. but what I'm trying to achieve is a count of how many of the following disks we have installed:

o 18gb
o 36Gb
o 72Gb
o 146Gb
o 300Gb
o 500Gb

etc.

I actually want to count the number of spindles within the estate, the free space within them I can already manage.

Sorry!
Johan Guldmyr
Honored Contributor

Re: Script to inventory hardware?

Wouldn't it be possible to alter that script to gather the total amount of space in each server instead?
Diego Castelli
Trusted Contributor

Re: Script to inventory hardware?

What About ACU CLI?

you can use:
\Bin>hpacucli controller slot=0 physicaldrive all show

to show all physicaldrive in the embedded Controller.

_______


if you want (or if some of the servers does not use controllers in slot=0) you can first obtain a list of controllers simply using:

\Bin>hpacucli controller all show detail.

Then, since scripting is not a problem here, you can manage the output and use it to feed the first command, iterated for each controller line.


HTH
:-)
Diego C.

MS MCSA Server 2003

HP Accredited Integration Specialist
Paul_637
Regular Advisor

Re: Script to inventory hardware?

@Johan - not really as that is still based on logical disk size

@Diego - Ah, now you're talking! I'll certainly give it a go (never used ACU cli so it'll be a good thing to check out anyway :)

Not quite as streamlined as I hoped (i.e. not able to run such a script from a single machine) but it gets me closer than I am ATM.

Will report back tomorrow...
Diego Castelli
Trusted Contributor

Re: Script to inventory hardware?

Johan, you have to calculate it:
sum the freespace value to a variable each time the loop goes, instead of printing it***.
after the loop print the variable in the output.


*** you can use operator to do this. example:

varName = varName + objDisk.FreeSpace
or
varName = varName + Round(objDisk.FreeSpace)

if you want to discuss it futher, open a new post and give the link. :-)
Diego C.

MS MCSA Server 2003

HP Accredited Integration Specialist
Diego Castelli
Trusted Contributor

Re: Script to inventory hardware?

Paul,
glad i had the right shot now.

i'll wait for the report. :-)
Diego C.

MS MCSA Server 2003

HP Accredited Integration Specialist
Paul Taylor
Advisor

Re: Script to inventory hardware?

I also have over 100 Proliant servers and get all this info, and more from Spiceworks.

You can download Spiceworks, from Spiceworks.com.
Its a IT Helpdek ticketing solution, but also has full network inventory built in. You can configure it to scan what ever network segments you have. It will then list out everything it has found in a Inventory. As you drill down into each machine you can see the full info. How many disks, sizes, Ram, and how many in which slots etc..
Brilliant program, and its free.

Diego Castelli
Trusted Contributor

Re: Script to inventory hardware?

Paul, glad to hear you managed to obtain needed info.

please, give points to contributors. :-)
Diego C.

MS MCSA Server 2003

HP Accredited Integration Specialist