Scripts

dotnet --list-sdks

List installed versions of dotnet sdks

dotnet
dotnet --list-runtimes

List installed versions of dotnet runtimes

dotnet
find . -maxdepth 1 -type d -exec echo {} \;

Loop through directories and execute command

bash
git reset HEAD --hard

Reset git repo to last commit

git
git reset origin/<branch> --hard

Reset git branch to match remote tracking branch

git
JSON.stringify(obj, null, 2);

Pretty print json in javascript

javascript
invoke-command -computername <servername> -scriptblock {C:\Windows\System32\inetsrv\appcmd.exe recycle apppool "<app pool name>"}

Recycle an app pool remotely

powershell
invoke-command -computername <servername> -scriptblock {(Get-IISAppPool).Name}

List app pools on remote server

powershell
net user <user> /domain

Query user info on the domain controller

cmd
az ad sp create-for-rbac -n <name> --role Contributor --scopes /subscriptions/<subscription id>/resourceGroups/<resource group> --query "{ client_id: appId, client_secret: password, tenant_id: tenant }"

Create azure service principal

az