Cheat Sheet - PowerShell

Cheat Sheet - PowerShell

Hide files

# Add Hidden attribute
(get-item test.txt).Attributes += 'Hidden'

# Remove "Hidden" attribute
(get-item test.txt -force).Attributes -= 'Hidden'

List installed PowerShell modules

# Get PowerShell modules installed using PowerShellGet
Get-InstalledModule

# See all modules installed 
Get-Module -ListAvailable

Base64 Encode String

$input = "Foobar­čĄ¬"
$byteString = [System.Text.Encoding]::UTF8.GetBytes($input)
$base64String = [System.Convert]::ToBase64String($byteString)

Base64 Decode String

$input = "Rm9vYmFy8J+kqg=="
$byteString = [System.Convert]::FromBase64String($input)
$text = [System.Text.Encoding]::UTF8.GetString($byteString)