Innovative Solutions: Exceptional I Services for Your Success

Innovative Solutions: Exceptional I Services for Your Success

Stephen Lv8

Innovative Solutions: Exceptional I Services for Your Success

Table of Contents

Disclaimer: This post includes affiliate links

If you click on a link and make a purchase, I may receive a commission at no extra cost to you.

IServices

https://techidaily.com

Declaration

IServices : IDispatch

Overview

This interface is meant to add new service operation or delete/edit the existing ones.

https://techidaily.com

Properties

Array ServiceOperations - Gets the collection of project service operations.

https://techidaily.com

Methods

NewServiceInstallOperation(IFile aServiceSourceFile) returns IServiceInstallOperation
Creates a new service install operation. Automatically adds a service control operation for the new service.

NewServiceControlOperation(String aServiceName) returns IServiceControlOperation
Creates a new service control operation.

NewServiceConfigureOperation(String aServiceName) returns IServiceConfigureOperation
Creates new service configure operation.

NewServiceFailureOperation(String aServiceName) returns IServiceFailureOperation
Creates new service configure operation.

DeleteServiceOperation(IBaseServiceOperation aOperation)
Deletes a service operation.

Example

$advinst = new-object -com AdvancedInstaller
$prj = $advinst.LoadProject(“D:\services.aip”)

Add new service install operation

$serviceInstall = $prj.Services.ServiceOperations | where {$.Name -eq “MyService” -and $.OperationType -eq “Service Install”}[0]

if($serviceInstall -eq $null)

$serviceExe = $prj.FilesComponent.Files | where {$_.Name -eq “MyService.exe”}[0]
if($serviceExe -eq $null)

  $serviceExe = $prj.FilesComponent.AddFileS("appdir", "D:\my_app_folder\MyService.exe")

$serviceInstall = $prj.Services.NewServiceInstallOperation($serviceExe)
$serviceInstall.Name = “MyService”

$serviceInstall.AllowDesktopInteraction = $true
$serviceInstall.Arguments = “/Run”
$serviceInstall.StartType = “OnDemand”

$serviceConfig = $prj.Services.ServiceOperations | where {$.Name -eq “MySecondService” -and $.OperationType -eq “Service Configuration”}[0]
if($serviceConfig -eq $null)

$serviceConfig = $prj.Services.NewServiceConfigureOperation(“MySecondService”)

$serviceConfig.ConfigureOnInstall = $true
$serviceConfig.ConfigureOnReinstall = $true
$serviceConfig.ConfigureOnUninstall = $false
$serviceConfig.SettingToChange = “TimeToRunFailureActions”

$serviceFail = $prj.Services.ServiceOperations | where {$.Name -eq “MySecondService” -and $.OperationType -eq “Service Failure”}[0]
if($serviceFail -eq $null)

$serviceFail = $prj.Services.NewServiceFailureOperation(“MySecondService”)

$serviceFail.ConfigureOnInstall = $true
$serviceFail.ConfigureOnReinstall = $true
$serviceFail.ConfigureOnUninstall = $false
$serviceFail.DaysBeforeResetFailureCount = 1
$serviceFail.RebootMessage = “”

$failureAction = $serviceFail.FailureActions | where {$_.Action -eq “RunProgram”}[0]
if($failureAction -eq $null)

$failureAction = $serviceFail.NewFailureAction(“RunProgram”, 1)

$serviceFail.RunProgram = “MySecondService.exe”
$serviceFail.RunProgramArguments = ‘/log “MySecondService has stopped.”‘

$prj.Save()

Copy
https://techidaily.com

See also

IBaseServiceOperation

IServiceInstallOperation

Topics

Did you find this page useful?

Please give it a rating:

Thanks!

Report a problem on this page

Information is incorrect or missing

Information is unclear or confusing

Something else

Can you tell us what’s wrong?

Send message

Also read:

  • Title: Innovative Solutions: Exceptional I Services for Your Success
  • Author: Stephen
  • Created at : 2024-10-07 18:45:02
  • Updated at : 2024-10-11 00:34:05
  • Link: https://fox-place.techidaily.com/innovative-solutions-exceptional-i-services-for-your-success/
  • License: This work is licensed under CC BY-NC-SA 4.0.