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?

marc_s
9,0626 gold badges46 silver badges52 bronze badges
asked Aug 13, 2015 at 12:54

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.

answered Aug 14, 2015 at 6:30
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.