Skip to content

Instantly share code, notes, and snippets.

@jwmoss
Forked from nohwnd/Uninstall-Pester.ps1
Created April 17, 2019 15:38
Show Gist options
  • Save jwmoss/9e119f27ef7e81d23ddd810569f06b76 to your computer and use it in GitHub Desktop.
Save jwmoss/9e119f27ef7e81d23ddd810569f06b76 to your computer and use it in GitHub Desktop.
Remove built-in version of Pester on Windows 10, and all other versions of Pester
#Requires -RunAsAdministrator
$modulePath = "C:\Program Files\WindowsPowerShell\Modules\Pester"
if (-not (Test-Path $modulePath)) {
"There is no Pester folder in $modulePath, doing nothing."
break
}
takeown /F $modulePath /A /R
icacls $modulePath /reset
icacls $modulePath /grant Administrators:'F' /inheritance:d /T
Remove-Item -Path $modulePath -Recurse -Force -Confirm:$false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment