PowerShell History (PSReadline)

Aus Wiki-WebPerfect
Version vom 7. März 2019, 17:45 Uhr von Admin (Diskussion | Beiträge)

(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

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

$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