How to Use PowerShell to Do a FIM MA Account Configuration Quick Test

How to Use PowerShell to Do a FIM MA Account Configuration Quick Test

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.

 

Leave a Comment
  • Please add 1 and 4 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Richard Mueller edited Revision 9. Comment: Replaced RGB values with color names in HTML to restore colors

  • Richard Mueller edited Revision 8. Comment: Removed (en-US) from title, added tag

  • Craig Lussier edited Revision 7. Comment: added en-US to tags and title

Page 1 of 1 (3 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Craig Lussier edited Revision 7. Comment: added en-US to tags and title

  • Richard Mueller edited Revision 8. Comment: Removed (en-US) from title, added tag

  • Richard Mueller edited Revision 9. Comment: Replaced RGB values with color names in HTML to restore colors

Page 1 of 1 (3 items)