I am new to Stack Over flow and did not know how to start. I have around 1500 PC's in my organization What I want is to write a simple script in PowerShell that will get a list of computers from a text file as input, get the info of my function and save the info to a CSV file as output.
What I am trying to do finding RAM Module capacities For example if you type
WMIC /NODE:MachineName Memorychip get capacity
It will give you each module capacity size of remote PC; for example I have a system which has 4 RAM modules installed each of 8 GB so output will be as
Capacity 8589934592 8589934592 8589934592 8589934592
it means 4 slots and each is of 8 GB
What I want is to use this simple command to write a script either in command line or in PowerShell (PowerShell is preferred).
To be more specific, here is what I am trying right now
$Result = @()
$servers = Get-Content "L:\Data.txt"
Foreach ($s in $servers) {
$Disk = (WMIC /NODE:$s MemoryChip Get Capacity)
$Object = New-Object -TypeName PSCustomObject -Property $Disk
}
$Result += $Object
}
$Result | Export-CSV "L:\RAMReport.csv" -NoTypeInformation -Encoding UTF8
I hope my question will be to the point
Thank you so much for the help