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)
No comments:
Post a Comment