Powershell Query

Associate
Joined
2 Aug 2005
Posts
589
I am new to powershell and still leaning the basics but I've got caught out doing something really simple. What I'm trying to do is export the BIOS properties of a number of servers in a text file, and export them to excel for reporting purposes, but for some reason my head can't work it out!

I've gotten so far at the moment, but this currently doesn't work:

Code:
$array = (Get-Content c:\servers.txt)

$array | ForEach-Object {
    Get-Wmiobject -ComputerName $_ win32_bios | Select-Object -Property PSComputerName, name, serialnumber, SMBIOSMajorVersion, SMBIOSMinorVersion
       }
Export-csv -path C:\export.csv -Append
 
Last edited:
Deviant-4, that worked a treat.

I have also written the following script:

Code:
# Get installed software from text file

#=====================================#

# Import contents of each line of .txt file
Get-Content c:\servers.txt | 

# Process each line and run it through Get-Wmiobject
ForEach-Object {Get-WmiObject -computername $_ Win32_Product | 

# Select each of the properties to display
Select-Object -Property PSComputerName, Name, Version, Vendor} | 

# Export to .csv file
Export-CSV -Path C:\installedSoftware.csv

If I wanted to integrate that into the script you've kindly provided, would that be easily done? I assume Export-CSV wouldn't suffice, and i'd need to use the excel cmdlet?

Thanks for your help up to now
 
Back
Top Bottom