PCSystemType on Remote Computers RRS feed

  • Question

  • I am extremely lucky to go through a MS Audit and they are asking me how many laptops/desktops are on the domain. I am trying to pull this data from PS but have no luck so far. Could anyone assist me on my ignorance?

    Here are some things I have tried.

    $Computers = Get-ADComputer -Filter * | Select Name		   
    foreach($comp in $computers)
    		Get-CimInstance -ClassName Win32_ComputerSystem -ComputerName $comp

    $ou = [ADSI]"LDAP://domainname.com CN=computers,DC=domainname,DC=com"
    $computers = $ou.PSBase.Get_Children()
    $arrInfo = @()
    foreach($node in $computers) 
    		$arrInfo += Get-WmiObject -query "Select Name,Manufacturer,Model, NumberOfProcessors, TotalPhysicalMemory, PCSystemType From Win32_ComputerSystem" -computername $node.Name  
    $arrInfo | format-table Name, Manufacturer, `
               Model, NumberOfProcessors, TotalPhysicalMemory,PCSystemType

    $Computers = Get-ADComputer -Filter * | Select Name
    $arrInfo = @()
    foreach ($node in $Computers) 
    		$arrInfo += Get-WmiObject -query "Select Name,Manufacturer,Model,PCSystemType From Win32_ComputerSystem" 
    		-ComputerName $node.name
    $arrInfo | FT Name, Manufacturer, Model,PCSystemType

    Edit**Forgot to mention I am trying to obtain PCSystemType within W32_ComputerSystem within the body of my question.

    Any help would greatly be appreciated, thank you!

    • Edited by Blacksuit1 Monday, December 17, 2018 7:37 PM
    Monday, December 17, 2018 6:49 PM


All replies

  • Any help with what, specifically?

    -- Bill Stewart [Bill_Stewart]

    Monday, December 17, 2018 6:53 PM
  • I am trying to get the Win32_ComputerSystem PCSystemType.
    Monday, December 17, 2018 7:36 PM
  • This works fine:

     Get-WmiObject Win32_ComputerSystem | select PCSystemType


    Monday, December 17, 2018 7:55 PM
  • If you take some time to learn PowerShell you wouldn't have to spend so much time guessing.

    Get-ADComputer -Filter * |
            Get-WmiObject Win32_ComputerSystem -ComputerName $_.Name
        } |
        Format-Table Name, Manufacturer, Model, PCSystemType

    PS is not that hard to learn but it cannot be learned by copying and guessing.

    1. Microsoft Virtual Academy - Getting Started with Microsoft PowerShell
    2. PowerShell Documentation
    3. PowerShell Style Guidelines


    • Marked as answer by Blacksuit1 Monday, December 17, 2018 8:32 PM
    Monday, December 17, 2018 7:59 PM
  • JRV,

    Thank you for your assistance. I am not the greatest at PowerShell but I keep notes on from over the years of my one liners. I was trying to put several things together in order to get this to work, I just didn't think of the ForEach-Object command.

    Glad to see I was not that far off, just had the wrong ForEach command. Thank you again!

    Monday, December 17, 2018 8:33 PM
  • Doing the tutorial from the above link will change all of that.  The course is given by the leader of the MS PowerShell Team so it is more accurate than many resources.   Take the course and you won't forget the obvious anymore.


    Monday, December 17, 2018 8:44 PM