79606878

Date: 2025-05-05 12:06:49
Score: 0.5
Natty:
Report link

You can change format data for your command. Suppose you want use command Get-Process:

Get-Proecess

The output:


Handles NPM(K) PM(K) WS(K) CPU(s)   Id SI ProcessName   
------- ------ ----- ----- ------   -- -- -----------   
    231     13  3608 12932        6388  0 AggregatorHost
    417     27 29728 40044   2.75 4592  0 AnyDesk       
...

Now, you want change format data in Handles's Column direction. You need to follow the steps below:

1- Get type name with Get-Member like this:

PS C:\Users\username> Get-Process | Get-Member

Output:

TypeName: System.Diagnostics.Process

Name                       MemberType     Definition                           
----                       ----------     ----------                           
Handles                    AliasProperty  Handles = Handlecount                
Name                       AliasProperty  Name = ProcessName                   
...

2- Get format data "System.Diagnostics.Process" with Get-FormatData cmdlet. Then Export it with Export-FormatData cmdlet. like this:

PS C:\Users\username> Get-FormatData -TypeName System.Diagnostics.Process | Export-FormatData -Path .\yourFolder\formatGetProcess.ps1xml

3- Then open formatGetProcess.ps1xml File with Notepad. If you have vscode, it's better. Try ReFormat this so see tags. Look this picture:

enter image description here

You can see Handles Field, width and alignment. Change alignment to "Left" and Save it.

4- Use Update-FormatData cmdlet to change Get-Process format data. Like this:

PS C:\Users\username> Update-FormatData -PrependPath .\yourFolder\formatGetProcess.ps1xml

After the above command, if you use Get-Process, you can see Handles's Column. it is Left side.


Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName                                                                
-------  ------    -----      -----     ------     --  -- -----------                                                                
225                                              6388   0 AggregatorHost                                                             
417                                              4592   0 AnyDesk                                                                    
...
Reasons:
  • Blacklisted phrase (1): enter image description here
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: MehrdadSalahi