Skip to content

Commit

Permalink
Fixes #1319 (#1325)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdriscoll authored Nov 19, 2019
1 parent 0c0907a commit 1eae7c4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/UniversalDashboard/UniversalDashboardServer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,9 @@ function Publish-UDDashboard {
[Parameter(Mandatory = $true)]
[string]$DashboardFile,
[Parameter()]
[string]$TargetPath = $PSScriptRoot
[string]$TargetPath = $PSScriptRoot,
[Parameter(ParameterSetName = 'Service')]
[Switch]$DontSetExecutionPolicy
)

$DashboardFile = Resolve-Path $DashboardFile
Expand Down Expand Up @@ -1526,7 +1528,13 @@ function Publish-UDDashboard {

$binPath = [System.IO.Path]::Combine($TargetPath, "net472", "UniversalDashboard.Server.exe")

sc.exe create UniversalDashboard DisplayName= "PowerShell Universal Dashboard" binPath= "$binPath --run-as-service" start= "$ServiceStart"
$args = "$binPath --run-as-service";
if ($DontSetExecutionPolicy)
{
$args += " --dont-set-execution-policy"
}

sc.exe create UniversalDashboard DisplayName= "PowerShell Universal Dashboard" binPath= "$args" start= "$ServiceStart"

Write-Verbose "Starting service UniversalDashboard"
sc.exe start UniversalDashboard
Expand Down

0 comments on commit 1eae7c4

Please sign in to comment.