Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

An empty pipe element is not allowed

$
0
0
$computers = Get-Content .Computerlist.txt $computerSystem = Get-CimInstance CIM_ComputerSystem $computerBIOS = Get-CimInstance CIM_BIOSElement $computerOS = Get-CimInstance CIM_OperatingSystem $computerCPU = Get-CimInstance CIM_Processor $computerHDD = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID = 'C:'" #Run the commands for each server in the list Foreach ($computer in $computers) { Write-Host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan "Manufacturer: " + $computerSystem.Manufacturer "Model: " + $computerSystem.Model "Serial Number: " + $computerBIOS.SerialNumber "CPU: " + $computerCPU.Name "HDD Capacity: " + "{0:N2}" -f ($computerHDD.Size/1GB) + "GB" "HDD Space: " + "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size) + " Free (" + "{0:N2}" -f ($computerHDD.FreeSpace/1GB) + "GB)" "RAM: " + "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB) + "GB" "Operating System: " + $computerOS.caption + ", Service Pack: " + $computerOS.ServicePackMajorVersion "User logged In: " + $computerSystem.UserName "Last Reboot: " + $computerOS.LastBootUpTime } Select-Object * | Export-Csv .computers.csv 

Trying to get inventory of remote machines and kick it to a csv file

submitted by /u/RebootTheServer
[link] [comments]

The post An empty pipe element is not allowed appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles