address some review feedback

This commit is contained in:
James Truher committed 2016-08-30 16:15:10 -07:00
1 parent f4ed351f86
commit 3ceca01b64
3 files changed
+29 -17

No files matched your search

+25 -1
View File
@@ -22,4 +22,28 @@ function Wait-CompleteExecution
}
return $true
}
export-modulemember -function Wait-CompleteExecution
function Test-IsElevated
{
$IsElevated = $False
if ( $IsWindows ) {
# on Windows we can determine whether we're executing in an
# elevated context
$identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$windowsPrincipal = new-object 'Security.Principal.WindowsPrincipal' $identity
if ($windowsPrincipal.IsInRole("Administrators") -eq 1)
{
$IsElevated = $true
}
}
else {
# on Linux, tests run via sudo will generally report "root" for whoami
if ( (whoami) -match "root" ) {
$IsElevated = $true
}
}
return $IsElevated
}
export-modulemember -function Wait-CompleteExecution,Test-IsElevated