We have multiple environments with different instance names. Currently I use this command to define the connection to the instace:
So the instance name is hard coded.
I am running the script as a job step and need this job to work in all environments without updating the job code.
How do I find out the server and the instance name with powershell on which the SQL job is running?
It is SQL Server job running a powershell step. I would assume it is already connected to sql server, just not sure how to extract the instance name it is executing against.
Powered by IDERA