2
  1. We are using a Visual Studio 2019 MSIX setup program to create a MSIX package.
  2. MSIX package installs a C++ Win32 Service.
  3. After service installation via MSIX setup we see that the service properties has

a. Recovery properties greyed out

enter image description here

b. Dependency properties are also greyed out

enter image description here

  1. We want to configure the Win32 Service for Auto-Recovery options as follows: enter image description here
  2. We have not found a way to set the above parameters from the package manifest file.
  3. Trying to set the parameters after installation using “sc” command, Win32 (Service Control Manager) API returns “Access Denied”, as we are not able to modify after installation the Win32 Service as it is a part of a MSIX package.
  4. Please provide help to how to set these parameters for a Win32 Service installed as part of a MSIX package.

Different options that we have tried and the corresponding error messages seen:

  1. Setting Win32 Service Dependency: Setting Test Win32 Service dependencies on ‘TestDriver’ (kernel mode driver) and ‘TcpIp’

We used following approaches to configure the dependent services:

a. Setting dependency service in manifest file

         <desktop6:Extension Category="windows.service">
            <desktop6:Service>
                <desktop6:Dependencies>
                    <desktop6:DependentService Name = "TestDriver">
                    </desktop6:DependentService>
                </desktop6:Dependencies>
            </desktop6:Service>

Microsoft Link Referred: https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-desktop6-dependentservice Result: MSIX package deployment fails with error 0x80080204: Cannot register the package due to the following error: The Appx package's manifest is invalid.

b. PowerShell script that uses WMI object:

$DependsOn = @('TestDriver','Tcpip')
$svc = Get-WmiObject win32_Service -filter "Name='TestService'"
$svc.Change($null,$null,$null,$null,$null,$null,$null,$null,$null,$null,$DependsOn)

We executed PowerShell scripts with the Package Support Framework by following below link: https://learn.microsoft.com/en-us/windows/msix/psf/run-scripts-with-package-support-framework

Result: Script execution fails with return value ‘2’

  1. Setting Auto-Recovery Options for a test Win32 Service We used following approaches to configure the recovery:

a. Executed following PowerShell script with the Package Support framework:

get-ciminstance win32_service -filter "name='TestService'" | Invoke-CimMethod -MethodName Change -Arguments @{ErrorControl=2}

Result: Execution fails with error code 2.

b. Used sc command line to modify service recovery options:

sc.exe failure "TestService" actions= restart/180000/restart/180000/reboot/180000 reset= 86400

Result: Error: OpenService FAILED 5: Access is denied.

c. Trying to set manually the Auto-Recovery from “Services” we get the below error: enter image description here

0 Answers0