• Tried to run the  script in our environment it gives below error.
    Please help to fix it. 

    Exception calling "Open" with "0" argument(s):
    "A network-related or instance-specific error occurred while establishing a connection to SQL Server.
    The server was not found or was not accessible.
    Verify that the instance name is correct an d that SQL Server is configured to allow remote connections.
    (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"