FIM ScriptBox Item

Summary

The objective of this script is to retrieve the configured FIM MA account configuration and verify that it has the right SID configured.

Script Code

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
#--------------------------------------------------------------------------------------------------------------------------
 set-variable -name RegKey -value "hklm:\SYSTEM\CurrentControlSet\Services\FIMService" -option constant 
#--------------------------------------------------------------------------------------------------------------------------
 write-host "`nFIM MA Account Quick Test"
 write-host "==========================="
#--------------------------------------------------------------------------------------------------------------------------
 if((test-path $RegKey) -eq $false)
 {throw (new-object ExecutionEngineException "FIM registry key not found")}
 $accountSid = (Get-ItemProperty "$RegKey").SynchronizationAccountSid
 $sid = new-object System.Security.Principal.SecurityIdentifier $accountSid
 $ntAccountFromSid = $sid.Translate([System.Security.Principal.NTAccount])
 $ntAccountFromReg = (Get-ItemProperty "$RegKey").SynchronizationAccount
 if(0 -ne [String]::Compare($ntAccountFromSid,$ntAccountFromReg, $true))
 {throw "Registry FIM MA account name and SID don't match!"} 
 write-host " -FIM MA account name: $ntAccountFromSid"
 write-host " -FIM MA account SID : $accountSid"
 write-host "Command completed successfully`n"
#--------------------------------------------------------------------------------------------------------------------------
 trap
 { 
    Write-Host "`nError: $($_.Exception.Message)`n" -foregroundcolor white -backgroundcolor darkred
    Exit
 }
#--------------------------------------------------------------------------------------------------------------------------

 

note Note
To provide feedback about this script, create a post on the FIM TechNet Forum.
For more FIM related Windows PowerShell scripts, see the FIM ScriptBox.

 



See Also