Configure users and Roles in App Controller with Powershell

December 26, 2013 at 12:41 pm in Powershell, SytemCenter by alkin

I had to configure remotely some users and Roles in App controller with Powershell.  You can find a lot of all App Controller CMDLets here

Below you can find the Powershell Script used to connect remotely to the app controller server and add users to the appropriate User Roles:

 # NAME: Configure App Controller
 # AUTHOR: Alexandre Verkinderen
 # DATE  : 10/29/2013
 # Requirements:

 $APPC = ""

Invoke-Command -ComputerName $APPC -ScriptBlock {

#import App Controller module
 Import-Module -Name AppController

 $APPC = "<a href=";">"</a>
 $User1 = "contoso\developer"
 $User2 = "contoso\endsuer"
 $Password = ConvertTo-SecureString "Passw0rd!" -AsPlainText -Force
 $username = "contoso\administrator"
 $Credentials = New-Object System.Management.Automation.PSCredential($username,$Password)

#Connect to App Controller
 Get-SCACServer -ServerName $APPC -Credential $Credentials

#Retrieve Userroles
 $UserRole = Get-SCACUserRole –Managed | where { $_.Name –eq "Administrators" }

#Add users to Administrator User Role

Set-SCACUserRole -UserRole $UserRole -AddMembers $User1,$User2
 Write-Host $User1 " and " $User2 " added to App Controller" -foregroundcolor green