

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to exclude PSComputerName property from Invoke-Command output in PowerShell?
When we are working with Invoke-Command, we get the PSComputerName extra field in the output table. You can remove it by using -HideComputerName parameter. For example, the Below command gives the output with the PSComputerName property.
Example
Invoke-Command -ComputerName LabMachine2k12 -ScriptBlock{Get-Service Winrm} | ft -AutoSize
Output
Status Name DisplayName PSComputerName ------ ---- ----------- -------------- Running Winrm Windows Remote Management (WS-Management) LabMachine2k12
To hide the PSComputerName property,
Example
Invoke-Command -ComputerName LabMachine2k12 -ScriptBlock{Get-Service Winrm} -HideComputerName
Output
Status Name DisplayName ------ ---- ----------- Running Winrm Windows Remote Management (WS-Management)
- Related Questions & Answers
- How to exclude the RunSpaceID property from the Invoke-Command output in PowerShell?
- How to work with Invoke-Command Scriptblock output?
- How to run Invoke-Command in PowerShell Workflow?
- How to pass arguments in Invoke-Command in PowerShell?
- How to convert command output to the Hashtable format in PowerShell?
- Difference between Write-Output and Write-Host command in PowerShell?
- How to run PowerShell commands from the command prompt?
- How to download images using Invoke-Webrequest in PowerShell?
- How to display specific properties from Get-Service output in PowerShell?
- How to run a PowerShell script from the command prompt?
- How to get website links using Invoke-WebRequest in PowerShell?
- How to get/resolve the command from the alias in PowerShell?
- How to sort the output in PowerShell?
- How to exclude specific extension in Get-ChildItem in PowerShell?
- How to export output to excel in PowerShell?
Advertisements