Invoke Powershell - how to always answer yes for prompts for Power Shell Scripts

I’m trying to run this script (which basically purges the Chrome Cache):

$Items = @('Archived History',
            'Cache\*',
            'Cookies',
            'Network\Cookies*',
            'History',
            'Login Data',
            'Top Sites',
            'Visited Links',
            'Web Data')
$Folder = "$($env:LOCALAPPDATA)\Google\Chrome\User Data\Default"
$Items | % { 
    if (Test-Path "$Folder\$_") {
        Remove-Item "$Folder\$_" 
    }
}

It works but it prompts for confirmation because of the first wildcard file.

Using the Invoke Power Shell activity, how do I send in “-Confirm:$False” or something like it to simply have it run the Power Shell script above.

This seemed to work:

$Items = @('Archived History',
            'Cache\*',
            'Cookies',
            'Network\Cookies*',
            'History',
            'Login Data',
            'Top Sites',
            'Visited Links',
            'Web Data')
$Folder = "$($env:LOCALAPPDATA)\Google\Chrome\User Data\Default"
$Items | % { 
    if (Test-Path "$Folder\$_") {
        Remove-Item "$Folder\$_" -Recurse -Force -Confirm:$False
    }
}

Accidentally deleted a prior post :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.