This is a script to remove remnants / old versions of Identity Finder for the purpose of reinstall or a SMS / SCCM push of a new version.
Prior to version 4.7x Identity Finder had no push Method from the Enterprise console so old clients must be managed another way
enter SMS / SCCM.
This script determines the bitness (32/64) of the client and proceeds to do the following:
Stops the Services
Try's to uninstall any old versions
Removes user base registry keys
Removes local machine base registry keys
Remove Identity Finder Program settings and files from ProgramData (doesn't nuke the directories just the files )
Adds the registry settings needed to connect to the enterprise console ( attached you must edit these see below )
Add the package to SMS / SCCM with the command line:
"powershell -f <powershellscriptfile.ps1>"
It's saves a log to the client machines' temp folder of the attempt to remove any previous version(s)
$64bitlevel=$true
if ((gwmi win32_computersystem).SystemType -like "*X86*") {#if1
$64bitlevel=$false
}#if1
#stop the service
Stop-Service IDFEndpointService
#uninstall the software
try{
$mymachine = get-content env:computername
$mytemp = get-content env:TEMP
$myresult = Get-WmiObject -Class Win32_Product | Where-Object -FilterScript {($_.Name -like "*Identity Finder*")}
if ($myresult -ne $null) {
$myresult | foreach {
$retcode = $_.Uninstall()
$myexitcode = $retcode.ReturnValue
$thisstr = "Machine: " + $mymachine + " Return Code: " + $myexitcode
$thisstr | out-file ($mytemp + "\RemoveIDF.log") -append -noclobber
} #end foreach
} #end if Null
} #End try
catch {
$mymachine = get-content env:computername
$mytemp = get-content env:TEMP
$thisstr = "Machine: " + $mymachine + " Time: " + (Get-Date) + " Error: " + $_
$thisstr | out-file ($mytemp + "\RemoveIDF.log") -append -noclobber
#exit fail
exit 1
} #end Catch
#Nuke User Settings
remove-item -Path 'HKCU:\SOFTWARE\Identity Finder' -Recurse -ErrorAction Continue
#Nuke ID Finder Machine Settings
if ( $64bitlevel ) {
remove-item -Path 'HKLM:\SOFTWARE\Wow6432Node\Identity Finder' -Recurse -ErrorAction Continue
reg import .\64_key.reg
Get-ChildItem 'c:\ProgramData\Identity Finder' -Recurse | foreach {#for1
if ( $_.PSIsContainer -ne $true ) {
Remove-Item ($_.PSPath)
}
} #for1
}
else {
remove-item -Path 'HKLM:\SOFTWARE\Identity Finder' -Recurse -ErrorAction Continue
reg import .\32_key.reg
Get-ChildItem 'c:\ProgramData\Identity Finder' -Recurse | foreach {#for1
if ( $_.PSIsContainer -ne $true ) {
Remove-Item ($_.PSPath)
}
} #for1
#for xp
Get-ChildItem 'c:\ProgramData\Application Data\Identity Finder' -Recurse | foreach {#for1 if ( $_.PSIsContainer -ne $true ) {
Remove-Item ($_.PSPath)
}
} #for1
}
#clean user profile for build
remove-item ($env:UserProfile + '\AppData\Local\Identity Finder') -Recurse
exit 0