I want to know, is there any way to find where timer-job is activated (url where timerjob's feature activated) using Powershell.
3 Answers
first use:
Get-SPFeature -Limit ALL | Where-Object {$_.Scope -eq "SITE"}
this gets all features from site scope! find your feature and copy the id!
next use this, havent properly tested this but i think its what your looking for!
Get-SPSite http://yoursite.co.uk | Get-SPWeb -Limit ALL | Where-Object { Get-SPFeature -Limit ALL -ErrorAction SilentlyContinue -Web $_ | Where-Object {$_.DisplayName -like "Publishing*"} } | Select url -Unique
it loops through all sites and subsites, if not found it wont throw error but instead ignore it... if found it will show the url at the end.
there is two areas you need to change, the url http://yoursite.co.uk and "Publishing*", the url is the location of the site you want to start from and the second part is the name of the feature your looking up against.
so if i have a site at 'home.co.uk' (root site collection) and looking for a feature called timrJbSearch than i would do:
Get-SPSite http://home.co.uk | Get-SPWeb -Limit ALL | Where-Object { Get-SPFeature -Limit ALL -ErrorAction SilentlyContinue -Web $_ | Where-Object {$_.DisplayName -like "timrJbSearch"} } | Select url -Unique
http://technet.microsoft.com/en-us/library/ff607945(v=office.15).aspx
just like to note when query against features they only show active and not inactive! inactive throws error.
-
So, I still need to have features name or ID, wanted to avoid this kind solution because my timerjobs name doesn't match features, bu i guess there is no other direct way– ViliusJul 18, 2014 at 8:34
There are timer jobs on Web Application levels, and you can use PowerShell to Start and Stop timer jobs, and more:
Disable-SPTimerJob
Disables a timer job.Enable-SPTimerJob
Enables a timer job.Get-SPTimerJob
Returns timer jobs.Set-SPTimerJob
Sets the schedule for running a timer job.Start-SPTimerJob
Runs a timer job once.
Se more here: Timer jobs cmdlets (SharePoint Server 2010)
-
This doesn't let me get URL of where they are activated, tried using those commands, directly through timer-job's object it's impossible (at least to my knowledge)– ViliusJul 18, 2014 at 8:03
-
@Vilius For what reason do you need the URL other than the web application URL to enable a timer job?– Benny Skogberg ♦Jul 18, 2014 at 8:08
-
It's not for enabling, I have a collection of timerjobs, of which some doesn't work right, i need to check if those are activated in the rightplaces– ViliusJul 18, 2014 at 8:12
-
@Vilius If a Timer Job is enabled, it is enabled for the entire web application– Benny Skogberg ♦Jul 18, 2014 at 8:13
-
Ok, sorry for misguiding you, It was needed for admins, they needed to know where to re-activate them because they planned to do a restoration– ViliusJul 18, 2014 at 8:18
The SharePoint timer service is a simple windows service. It's listed in the services screen. De timer service executables reside in the bin folder of the SharePoint $hive.
The SharePoint timer service is installed and activated by default. It should not be disabled. If you disable it, SharePoint will not run correctly.
You can programmatically add (and schedule) your own (custom) jobs to the timer service. SharePoint takes care of the execution and scheduling. You need Visual Studio to create a custom timer-job. You deploy it with a SharePoint solution package. You typically activate a custom timerjob on a site with a feature.
You can use the central administration page to get an overview (and status) of all the defined timerjobs in SharePoint including your custom created timer jobs. Note: monitoring jobs in central admin is not possible in the free version of SharePoint (SharePonit 20xx Foundation) https://stackoverflow.com/questions/4614780/how-to-check-whether-a-timer-job-has-run
You can also user PowerShell to view the status of a timerjob Get-SPTimerJob [-Identity ] | Format-Table -Property DisplayName,Id,LastRunTime,Status
http://technet.microsoft.com/en-us/library/ff607914(v=office.15).aspx