I am still new to learning powershell and I am having trouble with the code I wrote below. I keep receiving an RPC error when trying to send the commands to remote computers. Please look my code over to let me know what I’m doing wrong. Thanks for your help!
#variables $machines = get-content C:\Users\office\Desktop\Machines.txt $array = @() foreach ($machine in $machines){ $FreeGB = (gwmi win32_logicaldisk -ComputerName $machine -Filter drivetype=3).freespace /1gb -as [int] $Serial = (gwmi win32_bios -ComputerName $machine).serialnumber $Architecture = (gwmi win32_operatingsystem -ComputerName $machine).osarchitecture $OS = (gwmi win32_operatingsystem -ComputerName $machine).caption $computername = (gwmi win32_operatingsystem -ComputerName $machine).pscomputername $properties = @{Computer = $computername; FreeGB = $FreeGB; Serial = $Serial; Architecture = $Architecture; OS = $OS $output = New-Object psobject -Property $properties} $array += $output} Write-Output $output | ft -AutoSize