-
I have an Azure Powershell Runbook that is trying to add a folder to the Site Pages library using Add-PnPFolder. The runbook executes fine until it gets to the Add-PnPFolder line. Then it skips back to the top of the runbook script and starts executing again. The only thing I can think of is that Add-PnPFolder displays information after the folder is created and this is causing the Azure runbook to go crazy. The folder is getting created but the script never gets to the next line in the script. If I run this script locally it works fine. Here is a very basic version of the script. This may be a bug in Azure Runbooks but I'm not sure. Is there any way to make Add-PnPFolder run without returning anything to the screen? `$cred = Get-AutomationPSCredential -Name 'MyAutomationAccount' Connect-PnPOnline -Url 'https://tenant.sharepoint.com/sites/TestSite' -credential $cred Add-PnPFolder -Name 'Other Pages' -Folder 'SitePages' Write-Output "Other Pages folder created"` Output from Add-PnPFolder command: Name Type Items/Size Last Modified Other Pages Folder 0 3/17/2021 7:03:50 PM |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It never fails. As soon as you post looking for help you stumble on the answer. Apparently Azure Runbooks do have an issue with output from commands. So I just added " | Out-Null" to the end of the Add-PnPFolder command to discard the output and it works fine now. Hopefully this will help someone else some day. |
Beta Was this translation helpful? Give feedback.
It never fails. As soon as you post looking for help you stumble on the answer.
Apparently Azure Runbooks do have an issue with output from commands. So I just added " | Out-Null" to the end of the Add-PnPFolder command to discard the output and it works fine now. Hopefully this will help someone else some day.