powershell - Manually removing all of LogMeIn -
i have powershell script removes logmein (or program search name) add/remove programs.
this works remove instances of lmi, meaning version has been installed locally via plug-ins etc.
the way thought of doing delete respective registry entries , app data - querying hkey_users hive instead of hkcu hive proving troublesome.
anyone had similar, have search term in registry want blitz off? have tried mapping hkey_users ps-drive query cant terminology right.
function forceuninstall { stop-process -processname lmiguardian* stop-process -processname logmein* stop-process -processname logmeinsystray* stop-process -processname ramaint* $null = new-psdrive -psprovider registry -name hkey_users -root hkey_users cd hkey_users:/ $objects = get-childitem hkey_users:\ -erroraction silentlycontinue foreach ($object in $objects){ $testpath = "$($object.name)\software\logmein" $testpath = $testpath -replace [regex]::escape("hkey_users\"),'hkey_users:\' $testpath2 = "$($object.name)\software\logmein ignition" $testpath2 = $testpath2 -replace [regex]::escape("hkey_users\"),'hkey_users:\' if (test-path $testpath) { $pathstodelete += $testpath } if (test-path $testpath2) { $pathstodelete += $testpath2 } } foreach ($path in $pathstodelete){ write-host "removing $path" (get-childitem $path).pspath |remove-item -recurse "deleted registry key" } $localpaths = @("hkey_local_machine:\system\current control set\services\lmiinfo", "hkey_local_machine:\software\logmein" "hkey_local_machine:\system\current control set\services\lmimaint", "hkey_local_machine:\system\current control set\services\lmimirr", "hkey_local_machine:\system\current control set\services\lmirfsclientnp", "hkey_local_machine:\system\current control set\services\lmirfsdriver", "hkey_local_machine:\system\current control set\services\logmein") $location = new-psdrive -psprovider registry -name hkey_local_machine -root hkey_local_machine cd hkey_local_machine:/ foreach ($path in $localpaths){ write-host "removing $path" (get-childitem $path).pspath |remove-item -recurse "deleted registry key" } remove-itemproperty -path "hkey_local_machine:\software\microsoft\windows\currentversion\run" -name "logmein gui" write-host "removed logmein gui file" }
Comments
Post a Comment