Task Scheduler with Powershell Sharepoint ps1 -
To run SharePointShell script, I am using the following in the task scheduler: - Commands "& amp; C: \ users \ crpmcr \ Desktop \ upload \ script.ps1 '"
This is the restart of my script:
if ((get-PSSnapin "Microsoft. SharePoint PowerShell" -Reliance SilentlyContinue -q $ tap) {add-PSSnapin "Microsoft.SharePoint.PowerShell" } New item "[pat]" {$ Web = get-SPWeb "[WebApplicationUrl]"} {$ stream.WriteLine ("Click on" error ")} $ stream.close () If I remove the line in the try, then I Zhe get messages example line in my new file. But it seems that the line of effort breaks everything. My file has been created but it is empty even if some text has been added before.
Thank you.
Thanks
If you want to PowerShell
Running from: C: \ Windows \ SysWOW64 \ WindowsPowerShell \ v1.0 Try changing it
C: \ Windows \ System32 \ WindowsPowerShell \ v1.0
and see if it makes any difference.