Hi
\nIm working on a script that wil collect some info on all of my pc’s in my network.
\nSo far i have this script.<\/p>\n
\n$computers = Get-Content c:\\pstest\\computerlist.txt\n$disks = get-wmiobject -class \"Win32_LogicalDisk\" -namespace \"root\\CIMV2\" -computername $computer -Filter \"DriveType='3'\"\n$System = Get-WmiObject Win32_ComputerSystem -ComputerName $computer | Select-Object -Property Name\n\n$results = foreach ($computer in $computers)\n\n \n{\n\n $disk = get-wmiobject -class \"Win32_LogicalDisk\" -namespace \"root\\CIMV2\" -computername $computer -Filter \"DriveType='3'\"\n $System = Get-WmiObject Win32_ComputerSystem -ComputerName $computer | Select-Object -Property Name,Model\n $BIOS = Get-WmiObject Win32_BIOS -ComputerName $computer | Select-Object -Property SerialNumber\n\t $SystemOS = Get-WmiObject Win32_OperatingSystem -ComputerName $computer | Select-Object -Property caption\n $InstalledRAM = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $computer\n $disk = get-wmiobject -class \"Win32_LogicalDisk\" -namespace \"root\\CIMV2\" -computername $computer -Filter \"DriveType='3'\" | Select-Object name,size\n\n \n [PSCustomObject]@{\n\n Name = $System.Name\n\t \tModel = $System.Model\n SerialNumber = $BIOS.SerialNumber\n OperatingSystem = $SystemOS.caption\n Ram = $InstalledRAM = [Math]::Round(($InstalledRAM.TotalPhysicalMemory/ 1GB))\n Drive = $disk.Name\n \"Total Disk Size\" = $disk\n \n\n }\n }\n$results\n\n$results | Out-GridView\n$results | Format-Table -AutoSize\n$results | Export-Csv -Path c:\\disks.csv -NoTypeInformation -Encoding ASCII\n<\/code><\/pre>\n
Advertisement
and this is what i get