Monday, 22 July 2013

PowerShell Script to find OS Edition and Total RAM on a Server

# Script to find OS Edition and Physical RAM
# Created by - Vinoth N Manoharan
# Version 1.0
# Date - 22/07/2013
# Script Help :-
#---------------
# Parameter 1 :- UNC File Path with Server list
# Example1:- ServerOS.ps1 "Server List File Path"

Clear-Host
$List =@()
$List1 =@()
$final = @()
$filename = $args[0]
$computers = get-content $filename
foreach ($computer in $computers)
{
if($computer -ne $null)
{
$srt = "Server Name :- " + $computer
#$srt
#Echo "---------------------------"
$List = Get-WmiObject Win32_OperatingSystem -ComputerName $computer| SELECT CSName,Caption
$List1 = Get-WMIObject Win32_PhysicalMemory -ComputerName $computer| Measure-Object -Property capacity -Sum |select @{N="Total_Physical_Ram"; E={[math]::round(($_.Sum / 1GB),2)}}
$objvalue = $List1.Total_Physical_Ram
$List|Add-Member -Name Total_Physical_Ram -MemberType NoteProperty -Value $objvalue
$final += $List
}
}
$final|ft -AutoSize

Copyright © 2013 Vinoth N Manoharan.The information provided in this post is provided "as is" with no implied warranties or guarantees.

No comments:

Post a Comment