SharePoint job fails from Task Scheduler - sharepoint

I've got a .NET core application that run fine from a command prompt and creates SharePoint Sites and adds content types from templates. When I schedule it to run via Windows Scheduled Tasks with the same account it fails with the following error:
Error applying client template: The Provisioning Template URI MyTemplate.xml is not valid.
What would cause it to not run properly when scheduled?

Turns out it has nothing to do with SharePoint it is the Task Scheduler. Needs the proper settings in action for the directory/folder
Select Task -> Right Click -> Properties -> Actions Tab -> Select Action -> Edit -> Start in (optional)
See SO post here:
File not found using Task Scheduler

Related

Unnecessary Startup Command in Azure Pipelines for .NET Core Project

I've created a Linux App Service running .NET Core 2.2 on Azure. When I go to the deployment center and choose Azure-Repos/ Azure-Pipelines as the source control and then select my MVC Core repo, i'm required to enter a Startup Command, but deleting the command afterwards in the App Service's Configuration - General-Settings doesn't actually prevent the website from running?
Edit:
Actually, if I don't delete the Start-up command after deployment my app wouldn't run!
Well yes, AFAIK, it is true that the Startup command should be optional in the Deployment Center configuration blade, like it is in the Azure App Service Deploy task, unless it's needed for some other specific reason.
I shall check with our internal teams about this and get back with more details as I have them. Thanks for the question!
Update:
#jcmontx We have created a workitem to track and fix this. Please note that there are some other high priority changes planned for Linux Web App continuous delivery which will have effect on how startup command is handled. This means we will have first wait for these to complete before processing the requested change. Thanks for your patience!
I had the same problem. The only solution I found to this was to:
Add a random comment as Startup Command (your build may fail the first time) when setting up the Pipeline in the Deployment Center.
Then go to Azure Pipelines -> Releases -> Select YourPipeline -> Edit -> Tasks -> Select "Deploy Azure App Service"
Scroll down the options and you'll find "Startup command"
Remove your previous input (step 1)
Save

Trigger event with RDP login

I'm running Win 10 without running explorer.exe
At startup windows runs my default app, but I need to run explorer.exe whenever a RDP connection is done to the machine.
I'm been trying to find the RDP success login event to use in Task Scheduler, but have no look.
How to find the event to fill the fields Log:, Source: and Event ID: on Task Scheduler?
Thanks
Found it, actually its kind of simple.
Using Computer Management -> Event Viewer -> Applications and Services Logs -> Microsoft -> Windows -> TerminalServices-RemoteConnectionManager -> Admin and here you can see the last events, ID 20521 seems to be RDP login, not sure about this.
Right click and select Attach Task To This Event, from here configure Task Scheduler accordingly with your needs.
Don't know if there is a better way do do this, but it works for me.

how to perform background jobs in azure

I am new to azure.
I want to run some background process on schedule interval in azure.
for example i have sample web app that send test mail.how can I runthat on every 10 minutes in azure.
i read about webjobs and how can i schedule them. I tried also creating aconsole app and uploading .exe. it runs but gets filed.
I dont know how i can upload web app also as web job same as I did for exe??
or need to opt for another option like worker role..
I m totally new to it.. so please guys suggest what would be suitable for my requirement.
I will go through it .
EDIT:
Sending mail is not my requirement. i m just doing that to check is my web job running succesfully at scheduled time interval or not.
but as i m getting unexpected response i think i should write some other code like write textfile azure storage account at every minute..
as i m totaly new.. dont have any idea about that ..anyone can share me any good link or sample demo if you can.please.
Here are two ways to develop a web job.
First
Upload a zip file that contains your executable or script file as well as any supporting files needed to run the program or script. The supported executable or script file types are listed as below.
For example, if you want to use a console application as the web job, we can go to the [ApplicationSolutionFolder/bin] and compress the Release or Debug folder as an zip file(It's better to use Release folder), then upload this zip file to azure as the web job.
Second:
We can develop it via Visual Studio: Deploy a WebJobs project
Update:
As you want to run every 10 minutes, we can set the triggers as scheduled and set the CRON expressions as [0 */10 * * * *] when we upload our zip file.
More information about CRON expressions, we can refer to: CRON expressions

How can I report an Azure startup failure to user

My company produces a tool that the user installs on the server prior to publishing their project. For Azure deployment we have a startup script (a simple .cmd file) that installs our tool. It has the recommended checks for repeat runs, and logs everything. The problem is that the user can't tell if there was an installation problem without RDPing to the role instance and checking the logs.
My question is: if there is a failure installing our tool is there any way to report it back to Visual Studio?
I don't believe there is. If I recall correctly, the startup tasks are fired off as part of the role's startup process (depending on the startup task type - simple, background, etc.). That script is running along with other things like the plug-in that configures Remote Desktop (which I believe the plug-in is a specially packaged type of startup script). I don't think there is anyway to report back (to whatever initiated the deployment operation) what startup tasks failed.

Scheduled Tasks Fail to Run

I have a couple of scheduled tasks that run VBS script. It used to be set to "Run as" the person who has left our company. Obviously, after his account was removed, I had to change the tasks to run as another user.
We have an AD account that I setup to use to "run as" for each task. Tested the tasks by running it, scheduling it to run 2-3 minutes from now, and it worked. So, I scheduled the tasks to run everyday at the certain time. The next day the tasks failed with a following error:
The attempt to log on to the account associated with the task failed,
therefore, the task did not run.
The specific error is: 0x80070569: Logon failure: the user has not
been granted the requested logon type at this computer. Verify that
the task's Run-as name and password are valid and try again.
So, I go in and see that "Run As" logon stays the same, so I re-enter the password and test the task again. It runs fine, which tells me that it recognizes the logon and password used in the "Run As" property. The next day it fails again.
Any suggestions, recommendations at what to look at?
Thanks everyone!
The account your Scheduled Task is running as needs to have the "logon as a batch job" right given to it. Use the Group Policy editor (gpedit.msc) to add that right to the relevant account. Navigate down to Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> User Rights Assignment, and find Logon as a Batch Job. Then, add the account in question to that policy.
If it's helpful to anyone else, I had to set the GPO to enforced for my purposes.

Resources