Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Looping a function and outputting results to csv

$
0
0

I’m new to powershell and I’m now pushing the limits of ability with the following.

I found the following method for creating a function to gather machine info. Now I’m looking to loop the function for a large group of machines on my network and output the results to a single file or a csv.

Any help, or links pointing to the answer for this would be appreciated.

# This section creates a function that calls the info from a WMIObject  #
function Get-MachineInfo($ServerName="localhost")             
{            
get-wmiobject win32_computersystem -ComputerName $ServerName |            
select DNSHostName, Manufacturer, Model, SystemType ,             
        @{Name="TotalPhysicalMemoryInMB";Expression={"{0:n2}" -f($_.TotalPhysicalMemory/1mb)}},             
        NumberOfLogicalProcessors, NumberOfProcessors, CurrentTimeZone, DaylightInEffect            
}# End 

# This section calls the function #
Get-MachineInfo

Viewing all articles
Browse latest Browse all 13067

Trending Articles