I been trying to run this script for a while but i don't seem to be able to achieve what i want. I have a computer list that power shell is pointing to and will like to use it to recollect computer information and so far i think i got it but for some reason is not outputting the systems name.
$computers = Get-Content 'C:\New folder\computers.csv'
$Computers | Get-ComputerInfo | select SystemName, WindowsProductName, WindowsVersion | Format-List
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>
this is the output
SystemName :
WindowsProductName : Windows 10 Enterprise
WindowsVersion : 1909
<iframe name="sif2" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>
CodePudding user response:
SystemName is not a property of ComputerInfo. You probably mean CsName
.
Also, Get-ComputerInfo
returns information about the current machine. You have to use remoting:
Get-Content 'C:\New folder\computers.csv' | foreach {
Invoke-Command -ComputerName $_ -ScriptBlock {
Get-ComputerInfo CsName, WindowsProductName, WindowsVersion
}
}
(Note: For csv, consider using Import-Csv
instead.)