Skip to content

Commit

Permalink
Create test.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
gpproton committed Jul 15, 2023
1 parent dbf04df commit 9de60b4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
param(
[Parameter(Mandatory=$False, Position=0, ValueFromPipeline=$false)]
[System.String]
$Param1="help",

[Parameter(Mandatory=$False, Position=1, ValueFromPipeline=$false)]
[System.String]
$Param2="xx-xx-xx"
)

Write-Host $Param2

if ($Param1 -eq "help") {
Write-Host $Param1
}

# $isAdmin=([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
# if (!$isAdmin) {
# # Start-Process pwsh "-NoLogo -ExecutionPolicy Bypass -Command $PSCommandPath -Param1 $Param1 -Param2 $Param2" -Verb RunAs; # //Run this script as Administrator.
# # exit # //Exit from this non elevated context.
# }
# Write-Host $isAdmin

# function Test-Admin {
# $currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
# $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
# }
# # If we are in a non-admin execution. Execute this script as admin
# if ((Test-Admin) -eq $false) {
# exit
# }

0 comments on commit 9de60b4

Please sign in to comment.