Hello all !!
Im trying to configure a powershell script to run on remote hosts throughout our company network.
I am able to get the basic info that I need and export it to a CSV file but now I need to add the IP address to my spreadsheet. Here is the current code that I have, and its not working at all......
$machines = Get-Content "MachineList.txt"
$machines | ForEach-Object {
$IP = Get-WMIObject -Class Win32_NetworkAdapterConfiguration -ComputerName $_
$CS = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $_
$BIOS = Get-WmiObject -Class Win32_Bios -ComputerName $_
New-Object -Typename psobject -Property @{
IPAddress = $IP.IPAddress
Model = $CS.Model
Name = $CS.Name
SerialNumber = $BIOS.SerialNumber
UserName = $CS.UserName
}
} | Export-Csv -Path "c:\MachineExport.csv" –NoTypeInformation
If anyone can help me that would be great !!