24 lines
822 B
PowerShell
24 lines
822 B
PowerShell
|
[CmdletBinding()]
|
||
|
Param()
|
||
|
process {
|
||
|
$myCurrentPath = $PSScriptRoot;
|
||
|
Write-Verbose "Uninstalling the Module from $myCurrentPath";
|
||
|
|
||
|
$parentPath = (Split-Path $myCurrentPath);
|
||
|
$systemModulePath = "C:\Program Files\WindowsPowerShell\Modules\";
|
||
|
$myModulePath = (Join-Path $parentPath "module");
|
||
|
|
||
|
$metadata = ([Xml](Get-Content (Join-Path $parentPath "*.nuspec"))).package.metadata;
|
||
|
|
||
|
$id = $metadata.id;
|
||
|
$version = $metadata.version -replace '-pre.+','';
|
||
|
|
||
|
$targetModulePath = (Join-Path $systemModulePath $id);
|
||
|
$targetModuleVersionPath = (Join-Path $targetModulePath $version);
|
||
|
|
||
|
if (Test-Path $targetModuleVersionPath) {
|
||
|
Write-Information "Removing module at [$targetModuleVersionPath]!!"
|
||
|
Remove-Item $targetModuleVersionPath -Recurse -Force;
|
||
|
}
|
||
|
}
|