0

I have the following code which sucessfully stops a service on remote computer when run from the powershell console.

$Computer = "192.168.24.23"
$service = "Credential Checking LIVE"
Get-Service -ComputerName $Computer -name $service | Stop-Service

When i run this through a SQL Agent job the -ComputerName parameter is ignored.

Any ideas on why this would be and what i can do to rectify the problem?

4

1 回答 1

0

我会检查以下 1) SQL 代理是否有权执行?(就像 briantist 说的) 2)您是否尝试过将逻辑放入脚本中并从 SQL 执行脚本?3)您是否忘记了在测试时必须输入 Set-Execution 策略?

于 2015-02-09T19:49:55.273 回答