February 10, 2016 at 5:05 am
Hi Experts,
We have a powershell which we need to run from one of our SQL Servers. The script checks for a particular service in 4 servers and if it is stopped ,will start the same.
How can i achieve this?
February 10, 2016 at 6:11 am
VastSQL (2/10/2016)
Hi Experts,We have a powershell which we need to run from one of our SQL Servers. The script checks for a particular service in 4 servers and if it is stopped ,will start the same.
How can i achieve this?
Are you asking how to run a PS script from a SQL Agent job? Or something else?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
February 10, 2016 at 11:20 am
Phil Parkin (2/10/2016)
VastSQL (2/10/2016)
Hi Experts,We have a powershell which we need to run from one of our SQL Servers. The script checks for a particular service in 4 servers and if it is stopped ,will start the same.
How can i achieve this?
Are you asking how to run a PS script from a SQL Agent job? Or something else?
Thanks Phil,
Yes, but the job has to run as a different user .
February 17, 2016 at 7:56 am
I have some powershell scripts running which is used in a stored procedure.
This one is giving me all system configurations for the SQL Server
DECLARE @sql nvarchar(400)
set @sql = 'powershell.exe -c "Get-WmiObject -Class Win32_ComputerSystem"'
CREATE TABLE ##output
(line varchar(255))
insert ##output
EXEC xp_cmdshell @sql
SELECT * FROM ##output
WHERE line LIKE 'TotalPhysical%'
DROP TABLE ##output
February 17, 2016 at 8:41 am
What if the sql service on the server that's running the agent job stops? 😀
You should create a windows account, to use as a proxy, then on the job step you can use the run as drop down.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply