TrusteeName As String,
I_ServicePermissions As ServicePermissions
[in] String TrusteeName
Name of the user or group for whom the permissions are to set.
[in] String I_ServicePermissions
Permissions that are to be assigned to the specified user or group. The permissions possible include DenyAllAccessOnService, FullControlOnService, ManageServiceOperations, ViewServiceDetails and NoAccessOnService. See ServicePermissions for details
Grants the specified permissions to the user or group over the currently attached service. Note that you would need Change Permissions ("P") or Full Control ("F") over the service to perform this operation.
Dim ServiceSecurity As IServiceObjectSecurity
Set ServiceSecurity = CreateObject("DirectScript.ObjectSecurity")
'Attach to the messenger service on the computer "Moon".
ServiceSecurity.AttachService "messenger", "Moon"
'Remove all the permissions of the built-in group "Everyone".
ServiceSecurity.SetServicePermissions "Everyone", NoAccessOnService