none
Remove PSComputerName, RunSpaceID, and PSShowComputerName RRS feed

  • Question

  • Hi,

    I am running the following command.

    Invoke-Command -ComputerName RackHat -Credential $Cred -ScriptBlock {Get-Eventlog -Logname Application | Select-Object  -Property 'MachineName','Index','Source','Message' -ExcludeProperty 'PSComputerName', 'RunSpaceID','PSShowComputerName'} | ConvertTo-Html -Fragment

    I need to remove PSComputerName RunSpaceID PSShowComputerName from the output. I have tired different variations of this command and it keeps showing up. How do I exclude those categorizes? 

    Thanks

    Friday, September 30, 2016 7:01 PM

Answers

  • Don't use Invoke-Command.  It is not necessary.

    The Invoke-Command adds those.

    This:

     Get-WinEvent -Computer RackHat -Credential $cred -LogName application -max 6  |Select  MachineName,Id,ProviderName,Message

    Get-Eventlog is obsolete and less usable.


    \_(ツ)_/

    • Marked as answer by RackHat Monday, October 3, 2016 1:22 PM
    Friday, September 30, 2016 7:44 PM

All replies

  • Don't use Invoke-Command.  It is not necessary.

    The Invoke-Command adds those.

    This:

     Get-WinEvent -Computer RackHat -Credential $cred -LogName application -max 6  |Select  MachineName,Id,ProviderName,Message

    Get-Eventlog is obsolete and less usable.


    \_(ツ)_/

    • Marked as answer by RackHat Monday, October 3, 2016 1:22 PM
    Friday, September 30, 2016 7:44 PM
  • Thank you
    Monday, October 3, 2016 1:23 PM