Documentation for the helper command functions.
This commit is contained in:
parent
ba7d11e7f8
commit
4e0cb8cae9
@ -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)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user