So what I'm trying to do is pull an inventory of make, model, and serial numbers for a list of machines. I've only just gotten into Powershell as of last week so be easy on me.The problem I'm having is that it's only returning the last machine in the list that I have, if anything. I can verify that all the machines are connected and that I have administrative access to all of them. Here is the code I have:
$Cred= Get-Credential get-content targets.txt | foreach-object{ $Make = Get-WmiObject Win32_Computersystem -Computername $_ -Credential $Cred $Serial = Get-WmiObject Win32_BIOS -Computername $_ -Credential $Cred Select-Object $($Make).Name,$($Make).Manufacturer,$($Make).Model,$($Serial).SerialNumber } | Export-Csv Results.csv -NoTypeInformation
I also seem to have a problem with not getting a response back from some machines so the script hangs indefinitely and I'm not sure of a way to get around this other than stopping and restarting after removing that machine. Any help would be GREATLY appreciated!
- Edited by McCoid1017 21 hours 13 minutes ago