Quick one liner:
We've been working with consultants to evaluate our current infrastructure and they requested information regarding the disks and CPUs of our physical servers.
1. Create a csv file with the servers you wish to query in the following format:
2. This one-liner pulls the servers to be queried from the server1.csv file. It then injects the server names into the Get-WmiObject command. Finally, it dumps the output into the serverstorage.csv file.
For Disk info:
Import-Csv E:\server1.csv | ForEach-Object {Get-WmiObject Win32_LogicalDisk -ComputerName $_.server} | export-csv -path e:\serverstorage.csv
For CPU info:
Import-Csv E:\server1.csv | ForEach-Object {Get-WmiObject Win32_processor -ComputerName $_.server} | export-csv -path e:\cpuinfo01.csv
The dumps created provide heaps of details. Here's some of the more key columns.
Example Output:
Quick and easy.
11.18.15 Update.
For Memory info:
Import-Csv E:\server1.csv | ForEach-Object {Get-WmiObject Win32_physicalmemory -ComputerName $_.server} | export-csv -path e:\servermemory.csv
The disk size is in Bytes. To convert it to GB, I just use the following formula in Excel:
=A1/(1024*1024*1024)
I'm a Sr. Systems Engineer at a Global Environmental Engineering company. I've been in IT since 1999 and from 2005, my focus has been VMware datacenter products. More recently, my attention has been for Microsoft Azure services. As the Global Service Owner for VMware Datacenter products, I've had the pleasure of having in-depth and hands-on experience with not only VMware products, but server, storage and networking technologies.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment