Data collector stop issue

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 10 months, 1 week ago.

  • Author
  • #39224
    Profile photo of Ravi DS
    Ravi DS

    The below code snippet is throwing error as
    Exception calling "Stop" with "1" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
    Performance Log users group has access Log on as batch job in the sec policy.
    please help
    $dcset= new-object -COM Pla.DataCollectorSet;
    $name="User Defined\sql_2016";
    Write-host "Couldn't stop the Data collector"
    Write-host "Error: " $ErrorMessage

  • #39470
    Profile photo of Don Jones
    Don Jones

    It's definitely an "access denied" problem. Either the user you've specified doesn't have the necessary permission (and I'm not that knowledgeable on SQL Server data collectors, so I'm not going to be of any help there), or the COM object isn't marshalling correctly through .NET Interop.

    Sorry – I know that's not helpful to you, but this isn't really a PowerShell thing. You're using a COM object that messes with SQL Server – while you're using PowerShell to do it, none of my PowerShell experience helps me understand SQL or COM :).

You must be logged in to reply to this topic.