Forum Discussion

codyrhowe's avatar
codyrhowe
Copper Contributor
Mar 27, 2019

SharePoint 2016 - Custom Service 'CompliantWithMinRole' returning False

Pardon me if this is the incorrect place to ask this question. It's been quite some time since I've done SharePoint development for on-premises. I'm working on creating a service for SharePoint 2016 and when I debug and look at 'Services on Server', my service is showing 'No' under the Compliance column. In my service instance code I have overridden the 'ShouldProvision(SPServerRole serverRole)' method and provided the list of roles that the service should provision on, but still no luck with it showing as compliant. Is there something more than just overriding that method that needs to be done? Thanks in advance for any assistance.

  • majutras's avatar
    majutras
    Copper Contributor

    codyrhowe 

     

    I was in the same situation. I've fixed it by getting the service object from the servers service in PowerShell and run .Provision() on it. It became "Compliant".

     

    $server = Get-SPServer | where Address -eq "YourServerName"
    $serviceInstance = $server.ServiceInstances | where TypeName -eq "YourServiceInstanceName"
    $service = $serviceInstance.Service
    $service.Provision()

     I hope this helps.

Resources