wlado's website

PowerShell

PowerShell - mazání účtů

https://daniellbenway.net/delete-accounts-with-powershell/

PowerShell - Konverze na obyčejný text

https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/out-string

Out-String

PowerShell - Ořezání textu o mezery

https://blogs.technet.microsoft.com/heyscriptingguy/2014/07/18/trim-your-strings-with-powershell/

Priklad -- Trim specific characters

If there are specific characters I need to remove from both ends of a string, I can use the Trim(char[]) method. This permits me to specify an array of characters to remove from both ends of the string. Here is an example in which I have a string that begins with “a “ and ends with “ a”. I use an array consisting of “a”, “ “ and it removes both ends of the string. Here is the command:

$string = "a String a"

$string1 = $string.Trim("a"," ")

PowerShell - Formátování výstupu

Jak dostat výstup z příkazu do čitelnější tabulkové podoby.

https://msdn.microsoft.com/en-us/powershell/scripting/getting-started/cookbooks/using-format-commands-to-change-output-view

Příklad:

PS> Get-Process -Name powershell | Format-Table

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
1488 9 31568 29460 152 3.53 2760 powershell
332 9 23140 632 141 1.06 3448 powershell