Set-OutlookSignatures icon indicating copy to clipboard operation
Set-OutlookSignatures copied to clipboard

Access to the cloud file denied

Open dakolta opened this issue 3 years ago • 2 comments

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@

dakolta avatar Aug 10 '22 13:08 dakolta

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.

GruberMarkus avatar Aug 10 '22 15:08 GruberMarkus

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).

GruberMarkus avatar Aug 10 '22 15:08 GruberMarkus

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.

Set-OutlookSignatures.ps1.txt

GruberMarkus avatar Aug 14 '22 16:08 GruberMarkus

Update: Use v3.3.0-alpha1 or a newer version for your tests.

GruberMarkus avatar Aug 16 '22 08:08 GruberMarkus

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

dakolta avatar Aug 19 '22 15:08 dakolta

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.

GruberMarkus avatar Aug 19 '22 17:08 GruberMarkus

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.

GruberMarkus avatar Aug 20 '22 02:08 GruberMarkus