Skip to content

Instantly share code, notes, and snippets.

@jeremypage
Last active April 17, 2025 08:14
Show Gist options
  • Save jeremypage/0879f1e792fa44c016f4 to your computer and use it in GitHub Desktop.
Save jeremypage/0879f1e792fa44c016f4 to your computer and use it in GitHub Desktop.
Powershell cheatsheet

Powershell Cheatsheet

Get all AD properties of user:

Get-ADUser %username% -properties *

Get all AD properties of user by email address:

Get-ADUser -Filter {EmailAddress -eq '[email protected]'} -Properties *

Convert all file names in current directory to lowercase:

dir | % { if ($_.Name -cne $_.Name.ToLower()) { ren $_.FullName $_.Name.ToLower() } }

Replace all file name underscores with hyphens in current directory:

dir | Rename-Item –NewName { $_.name –replace _,- }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment