Set-OutlookSignatures
                                
                                 Set-OutlookSignatures copied to clipboard
                                
                                    Set-OutlookSignatures copied to clipboard
                            
                            
                            
                        Access to the cloud file denied
Rolled out Set-OutlookSignatures to a new user and got the following error:
Copy signatures to AdditionalSignaturePath @2022-08-10T09:11:17-04:00@
  'C:\Users\jvogel\OneDrive - Developer's Mortgage Company\Documents 2\Documents\Outlook Signatures'
PS>TerminatingError(Remove-Item): "Access to the cloud file is denied"
>> TerminatingError(Remove-Item): "Access to the cloud file is denied"
Unexpected error. Exit.
Remove-Item : Access to the cloud file is denied
At C:\drivers\desktops\Set-OutlookSignatures\Set-OutlookSignatures.ps1:2138 char:91
+ ... .fullname | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Remove-Item], Win32Exception
    + FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.RemoveItemCommand
Clean-up @2022-08-10T09:11:17-04:00@
End script @2022-08-10T09:11:17-04:00@
This seems to be a problem caused by the Files-On-Demand feature of OneDrive.
Disable the Files-On-Demand Feature, wait until the sync completed and let me know if the problem is still there.
Also, use the latest version of Set-OutlookSignatures for your tests (the error message does not come from the most recent version v3.2.1, as the line numbers do not match).
I can't reproduce the problem on my systems, but have found a possible workaround in the internet.
Let me know if the attached alpha version works. Run it with the '-verbose' parameter and post the whole script output.
Update: Use v3.3.0-alpha1 or a newer version for your tests.
Sorry for the delay, had a hard time getting the user to leave that computer on. Here is a full text from the running of the script. SetSig.txt
The log file shows that the workaround seems to solve the problem.
The error messages regarding DLL files which can not be deleted are expected, they happen because of PowerShell and .Net restrictions.
Version 3.3.0-alpha2, which will no longer show these expected error messages, will be released in a few minutes. Release v3.3.0-alpha2 will deploy signatures for automapped and additional mailboxes per default, see CHANGELOG and README for details.
You may want to have a look at the '-GraphOnly true' parameter, if all the information relevant for Set-OutlookSignatures can be found in Microsoft Graph and no connection to an Active Directory instance on-prem is required.
Closing, as v3.3.0-alpha2 and newer use an alternative approach to delete files and folders that possibly reside on OneDrive. This alternative approach avoids the "access to the cloud file is denied" error.