Skip to content

Adding -Recurse option would allow for simpler Install/Uninstall scripts #1

Description

@its-vincent

Firstly, thanks for the very useful Templates. I have been testing deploying an app using them for the past couple of days.

I wanted to roll out Notepad++ with a selected set of plugins enabled while also forbidding updating or downloading additional plugins (installations by users are forbidden at the AD level)

I installed the relevant version of Notepad++ and all the required plugins on a testbed, then got the complete list of additional files deployed by them. Then I removed the Notepad++ App again. This left the plugins folder behind with just the additional folders/files for the added plugins. I copied this plugins folder to the Intune Source folder. It contains quite a long list of files, but adding them all one by one worked.

On researching the Copy-Item and Remove-Item powershell commands, I found both have a -Recurse option available.

In my testing, by simply adding the -Recurse option to both Copy-Item commands in the install script, and to both Remove-Item commands in the Uninstall script, I could reduce the Copy and Delete arrays to just one single line.

$FilesToCopy = @(
    # @{ Source = "another-file.xml"; Destination = "C:\ProgramData\MyApp" }
    @{ Source = "plugins"; Destination = '$env:ProgramW6432\Notepad++' }
)

                Copy-Item -Path $sourcePath -Destination $destPath -Force -Recurse 

$FilesToRemove = @(
    # '$env:APPDATA\Notepad++\imabdk-config.json'
   '$env:ProgramW6432\Notepad++'
)

                Remove-Item -Path $filePath -Force -Recurse

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions