diff --git a/PS/PowerShellProfile.ps1 b/PS/PowerShellProfile.ps1 index 9bf8a64..7548376 100644 --- a/PS/PowerShellProfile.ps1 +++ b/PS/PowerShellProfile.ps1 @@ -9,6 +9,10 @@ function prompt { "PS> " } +<# + .Synopsis + Invoke a scriptblock with evelvated permissions. +#> function Invoke-Elevated { param ( [ScriptBlock] @@ -18,14 +22,31 @@ function Invoke-Elevated { Start-Process powershell.exe -ArgumentList $code -WindowStyle hidden -Verb RunAs } -# helper command to get whether we are running under elevated privileges or not. +<# + .Synopsis + Returns true if you are running with elevated privileges. +#> function Get-Elevated { ([Security.Principal.WindowsPrincipal] ` [Security.Principal.WindowsIdentity]::GetCurrent() ` ).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) } -# Helper command to make symbolic links. +<# + .Synopsis + Create a symlink from a source to a destination. + + .Description + Creates a symlink from a $Source to a $Destination. + Automatically elevates to administrator privileges + if necessary. + + .Parameter Source + Required source to create the symlink from. + + .Parameter Destination + Required destination to create the symlink at. +#> function New-Link { param ( [Parameter(Position=0, Mandatory=$true)]