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?
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 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy