I am trying to get items from SharePoint Online using Power Shell and want to insert to SQL server. I tried the following code and it is working. But I have a problem when I put that .ps file on Task Schedule. At that time, it is not working and not insert data in database table. If manual run , it is fine.How can I do it?