11if (! ([Security.Principal.WindowsPrincipal ][Security.Principal.WindowsIdentity ]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole ] " Administrator" )) { Start-Process powershell.exe - ArgumentList " -NoProfile" , " -ExecutionPolicy Bypass" , " -Command" , " cd `" $ ( $PWD.Path ) `" ; .\ps2exe.ps1" - Verb RunAs; exit }
22
3- $nuget = Get-PackageProvider - Name " NuGet"
3+ $workpath = $PSScriptRoot
4+
5+ Set-Location - Path $workpath
6+
7+ # Do not prompt user for confirmations
8+ Set-Variable - Name ' ConfirmPreference' - Value ' None' - Scope Global
9+
10+ Install-PackageProvider NuGet - Scope AllUsers - ForceBootstrap - Confirm:$false - Force
11+ $nuget = Get-PackageProvider - Name " NuGet" - ErrorAction SilentlyContinue
412
513if ($nuget ) {
614 $psgallery = (Get-PSRepository - Name " PSGallery" ).InstallationPolicy
715 if ($psgallery -eq " Trusted" ) {
816 $ps2exe = Get-Module - Name " ps2exe"
917 if (! ($ps2exe )) {
10- Install-Module ps2exe - Repository PSGallery
18+ Install-Module ps2exe - Repository PSGallery - Scope AllUsers - SkipPublisherCheck - Force
1119 Import-Module - Name " ps2exe" - Force
1220 } else {
1321 Import-Module - Name " ps2exe" - Force
1422 }
1523 } else {
1624 Set-PSRepository PSGallery - InstallationPolicy Trusted
1725 if (! ($ps2exe )) {
18- Install-Module ps2exe - Repository PSGallery
26+ Install-Module ps2exe - Repository PSGallery - Scope AllUsers - SkipPublisherCheck - Force
1927 Import-Module - Name " ps2exe" - Force
2028 } else {
2129 Import-Module - Name " ps2exe" - Force
2230 }
2331 }
2432} else {
25- Install-PackageProvider NuGet - Force
33+ Install-PackageProvider NuGet - Scope AllUsers - ForceBootstrap - Confirm: $false - Force
2634 Set-PSRepository PSGallery - InstallationPolicy Trusted
27- Install-Module ps2exe - Repository PSGallery - Force
35+ Install-Module ps2exe - Repository PSGallery - Force - Scope AllUsers - SkipPublisherCheck - Force
2836 Import-Module - Name " ps2exe" - Force
2937}
3038
3139Import-Module - Name " ps2exe" - Force
32- ps2exe .\Nginx- Manager.ps1 .\Nginx-Manager.exe - x64 - noConsole - UNICODEEncoding - iconFile .\nginx.ico - title " Nginx Manager" - description " Nginx Manager" - product " Nginx Manager" - version 1.0 .0.0 - noOutput - exitOnCancel - DPIAware - winFormsDPIAware
40+ ps2exe .\Nginx- Manager.ps1 .\Nginx-Manager.exe - x64 - noConsole - UNICODEEncoding - iconFile .\nginx.ico - title " Nginx Manager" - description " Nginx Manager" - product " Nginx Manager" - version 1.0 .0.0 - noOutput - exitOnCancel - DPIAware - winFormsDPIAware
0 commit comments