Forum Discussion

Rambo363636's avatar
Rambo363636
Brass Contributor
Jul 19, 2024

How to delete files remotely on Intune devices

Hi All,

 

Please help me to delete below files at below location remotely on all intune devices.
%appdata%\Microsoft\usertemplates\wordtemplate1.dotx
%appdata%\Microsoft\usertemplates\wordtemplate1.dotm

Thank you

1 Reply

  • Matt_Clarke-ESi's avatar
    Matt_Clarke-ESi
    Copper Contributor

    Rambo363636 

     

    Good day,

    The way I would do it is to use Scripts and remediations.

    (I've updated the path to Microsoft\templates and not Microsoft\usertemplates so edit it back if you need to.)

     

    $1dotx = "C:\Users\*\AppData\Roaming\Microsoft\templates\wordtemplate1.dotx"
    If(Test-Path -Path $dotx1){Remove-Item -Path $1dotx -Force}
    $1dotm = "C:\Users\*\AppData\Roaming\Microsoft\templates\wordtemplate1.dotm"
    If(Test-Path -Path $dotm1){Remove-Item -Path $1dotm -Force}

     

     

    I would suggest wrapping in a try catch, and add error handling as well.

    Best wishes, Matt

Resources