Skip to content

Instantly share code, notes, and snippets.

@mikeplate
Created July 15, 2021 13:29
Show Gist options
  • Save mikeplate/b88a40f3057453a7258eb1b60cc40edf to your computer and use it in GitHub Desktop.
Save mikeplate/b88a40f3057453a7258eb1b60cc40edf to your computer and use it in GitHub Desktop.
PowerShell Snippets
# Run sql command and store result as csv
Invoke-Sqlcmd -ServerInstance localhost -Database dbname -Username usr -Password rty "select top 100 * from [Log]" | ConvertTo-Csv -Delimiter "`t" > output.csv
# Total size of all files in all subfolders of the current folder
Get-ChildItem . -Recurse | Measure-Object -Property Length -Sum
# Store result of http request in file
Invoke-WebRequest -Uri "https://site.com" | Select-Object -ExpandProperty Content > site.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment