Created
July 4, 2016 00:01
-
-
Save mattwoolnough/2d0854dc8750569c9f97929b7b47b6f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Username of the user to add | |
$username = "svc_fim_service" | |
# Domain of the user to add | |
$domain = "FIMDev" | |
# Display name to set in the portal | |
$displayName = "FIM Service Service Account" | |
Import-Module LithnetRMA | |
Set-ResourceManagementClient -BaseAddress localhost # -Credentials (Get-Credential) | |
$objUser = New-Object System.Security.Principal.NTAccount($domain,$username) | |
$strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier]) | |
$bytes = New-Object byte[] $strSID.BinaryLength | |
$strSID.GetBinaryForm($bytes, 0) | |
# Create the resource | |
$o = New-Resource -ObjectType Person | |
$o.AccountName = $accountName | |
$o.Domain = $domain | |
$o.DisplayName = $displayName | |
$o.ObjectSID = $bytes | |
Save-Resource $o | |
# Add to administrators set | |
$set = Get-Resource Set DisplayName Administrators | |
$set.ExplicitMember.Add($o) | |
Save-Resource $set |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment