I am trying to run the below PowerShell script from a job step:
I found a beautiful way to solve this problem for SQL jobs, you just need to use this command to extract the instance name:
$Srv = '$(ESCAPE_SQUOTE(SRVR))'
This won't work from Powershell window, only in a job step.
Powered by IDERA