6

I have a SQL Server Agent job that calls a PowerShell script in one step. And I want to pass the SQL server name and the current job-id to my script.

With the job-id I have no problems. But with the server name...

My PowerShell call looks like this:

.\StopServices.ps1 -ServerName $(ESCAPE_DQUOTE(A-SVR)) -JobId $(ESCAPE_DQUOTE(JOBID))

The job-id works perfect, but the server name is empty.

How can I pass the server name to my PowerShell script?

1 Answer 1

5

Replace A-SVR with SRVR.

A-SVR is for alerts.

SRVR will contain server name and instance name.

Refer to document on MSDN.

1
  • Many thanks! That was the mistake... "D'oh!" :) Aug 17, 2015 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.