Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Triggering a scheduled job remotely

$
0
0

this is what I would like to do:

fire off sql server backups using a scheduled job ie register-scheduledjob ...

Then be able to trigger it to run from a remote machine using some variant of invoke-command   ....{start-job -definitionname xxx}

As a simple test the scheduled job on the sql machine just does a { date >c:\backups\output.txt } and if I do the start-job the job runs and updates the output.txt file (job is called dodate1)

if however I go to a remote system and do the Invoke-Command -ComputerName SQLSRVA  -ScriptBlock {Start-Job -DefinitionName dodate1}  the job appears to fire off and shows having run with no errors that I can find but the output.txt doesn't change.

I'm pulling my hair out on this one.

Any ideas?

 

BTW where I'm going with this is that I want to trigger this job from an asp.net app (calling powershell script to remotely fire backup script in addition to script being triggered nightly)


Viewing all articles
Browse latest Browse all 6937

Trending Articles