Beta_cartrigesg_bd Beta v0.8
This commit is contained in:
45
installer/configure_inventera_autostart.ps1
Normal file
45
installer/configure_inventera_autostart.ps1
Normal file
@@ -0,0 +1,45 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$ExecutablePath,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$WorkingDirectory
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$taskName = 'Inventera Server'
|
||||
|
||||
if (-not (Split-Path -Parent $ExecutablePath)) {
|
||||
throw 'The Inventera executable path is invalid.'
|
||||
}
|
||||
|
||||
$action = New-ScheduledTaskAction `
|
||||
-Execute $ExecutablePath `
|
||||
-WorkingDirectory $WorkingDirectory
|
||||
|
||||
$trigger = New-ScheduledTaskTrigger -AtStartup
|
||||
|
||||
$settings = New-ScheduledTaskSettingsSet `
|
||||
-StartWhenAvailable `
|
||||
-RestartCount 5 `
|
||||
-RestartInterval (New-TimeSpan -Minutes 1) `
|
||||
-ExecutionTimeLimit ([TimeSpan]::Zero) `
|
||||
-MultipleInstances IgnoreNew
|
||||
|
||||
$principal = New-ScheduledTaskPrincipal `
|
||||
-UserId 'SYSTEM' `
|
||||
-LogonType ServiceAccount `
|
||||
-RunLevel Highest
|
||||
|
||||
$task = New-ScheduledTask `
|
||||
-Action $action `
|
||||
-Trigger $trigger `
|
||||
-Settings $settings `
|
||||
-Principal $principal `
|
||||
-Description 'Starts the Inventera web server when Windows starts.'
|
||||
|
||||
Register-ScheduledTask `
|
||||
-TaskName $taskName `
|
||||
-InputObject $task `
|
||||
-Force | Out-Null
|
||||
Reference in New Issue
Block a user