none
Cannot run powershell commands? RRS feed

  • Question

  • Hello,

    I am trying to run a query on the WMI objects but it is failing...

    Invoke-Command -ComputerName $server {Get-WmiObject -query "select * from _Namespace"}


    PS C:\windows\system32> Invoke-Command -ComputerName $server {Get-WmiObject -query "select * from _Namespace"}
    Invoke-Command : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an
    argument that is not null or empty, and then try the command again.
    At line:1 char:30
    + Invoke-Command -ComputerName $server {Get-WmiObject -query "select * from _Names ...
    +                              ~~~~~~~
        + CategoryInfo          : InvalidData: (:) [Invoke-Command], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand
    

    What is wrong?

    Thanks,

    Dom


    Security / System Center Operations Manager 2012 / System Center Configuration Manager 2012 / SQL System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager

    Monday, July 3, 2017 4:25 PM

Answers

  • Find out that the command uses __Namespace instead of _namespace (double underscores)

    Thanks,
    DOm


    Security / System Center Operations Manager 2012 / System Center Configuration Manager 2012 / SQL System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager

    • Marked as answer by Felyjos Monday, July 3, 2017 5:47 PM
    Monday, July 3, 2017 5:47 PM