Last active
June 12, 2019 19:30
-
-
Save Dalstroem/e85a5d8d46f72ebc52cfcf32055c0e5d to your computer and use it in GitHub Desktop.
PowerShell scripts and functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-Password ($Length=60) { | |
$characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
$random = 1..$Length | ForEach-Object { Get-Random -Maximum $characters.Length } | |
$characters[$random] -join '' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Open-VisualStudioSolution ($Directory) { | |
$solutions = Get-ChildItem -Recurse -Path "$Directory*.sln" | |
if ($solutions.Count -eq 1) { | |
Invoke-Item $solutions.FullName | |
} | |
elseif ($solutions.Count -eq 0) { | |
Write-Host "Couldn't find any solution files here." -ForegroundColor Red | |
} | |
elseif ($solutions.Count -gt 1) { | |
Write-Host "Which one do you want to open?" -ForegroundColor Magenta | |
$root = (Get-Location).Path | |
$solutions | ForEach-Object { | |
$path = $_.FullName.Replace($root, '').TrimStart("\\") | |
Write-Host " - $path" | |
} | |
} | |
} | |
Set-Alias vs Open-VisualStudioSolution |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment