Skip to content

PowerShell

Get today’s date and time where time is set to midnight

Terminal window
[DateTime]::Today

Show list of logged on users

Terminal window
query user /server:$SERVER

Log off user by specifying session ID

Terminal window
logoff <session ID>

Reload a local module

Terminal window
Import-Module -Name .\module.psd1 -Force

Pretty-print minified JSON

Terminal window
$String | ConvertFrom-Json | ConvertTo-Json -Depth 100

Convert from Base64

Terminal window
[Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($String))

Convert string to boolean

Terminal window
[System.Convert]::ToBoolean($String)

Resolve FQDN

Terminal window
[System.Net.Dns]::GetHostByName($FQDN)