PowerShell History (PSReadline): Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „== Get PowerShell History Size for all Users (for example on a Jumphost == ''This little CMDLET is usefull to collect the Size of the PowerShell History from P…“)
 
 
(3 dazwischenliegende Versionen des gleichen Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
== Get PowerShell History Size for all Users (for example on a Jumphost ==
+
== Get PowerShell History Size for all Users (for example on a Jumphost) ==
''This little CMDLET is usefull to collect the Size of the PowerShell History from PowerShell-Module PSReadline''
+
''This little CMDLET is usefull to collect the Size of the PowerShell History from PowerShell-Module PSReadline. A big "ConsoleHost_history.txt" File can cause performance problems with PowerShell.''
 
<source lang="powershelL">
 
<source lang="powershelL">
 
$UserPaths = (Get-ChildItem "C:\Users" | ? {$_.Mode -match "d----l"}).FullName
 
$UserPaths = (Get-ChildItem "C:\Users" | ? {$_.Mode -match "d----l"}).FullName
Zeile 12: Zeile 12:
 
</source>
 
</source>
  
More Information about this Bug: https://github.com/lzybkr/PSReadLine/issues/537  
+
More Information about this Bug: https://github.com/lzybkr/PSReadLine/issues/537 <br>
 
+
''-> It is fixed in PSReadline Version 2.0 and does ship in Windows 10 1809.''
  
  

Aktuelle Version vom 8. März 2019, 11:42 Uhr

Get PowerShell History Size for all Users (for example on a Jumphost)

This little CMDLET is usefull to collect the Size of the PowerShell History from PowerShell-Module PSReadline. A big "ConsoleHost_history.txt" File can cause performance problems with PowerShell.

$UserPaths = (Get-ChildItem "C:\Users" | ? {$_.Mode -match "d----l"}).FullName
 
Foreach ($UserPath in $UserPaths) {
    New-Object psobject -Property @{
        UserPath = $UserPath
        SizeKB = ([Math]::Round((Get-ItemProperty "$UserPath\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt").Length /1KB,2))
    } 
}

More Information about this Bug: https://github.com/lzybkr/PSReadLine/issues/537
-> It is fixed in PSReadline Version 2.0 and does ship in Windows 10 1809.