Computer information problem

Welcome Forums General PowerShell Q&A Computer information problem

This topic contains 1 reply, has 2 voices, and was last updated by

1 year, 9 months ago.

  • Author
  • #72995

    Points: 0
    Rank: Member

    I am trying to get computer information from remote computers using the following. However, it errors out. Maybe someone can point me in the right direction or tell me what I am doing wrong.

    $computers = Get-Content -Path "list.txt"
    Get-WmiObject -Class Win32_ComputerSystem $computers

    This is the error:

    Get-WmiObject : Invalid query "Select Computer 1, computer 2, Etc.

    It does list all the computers from the list.txt file.

  • #72997

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    You need to use parameter names for everything – as-is, they're not in the right order, which is easy to do when you don't use the names.

    Get-WmiObject -Class Win32_ComputerSystem -ComputerName $computers

    What you're doing is providing $computers as part of the query string, which isn't correct.

The topic ‘Computer information problem’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort