Home General Discussion
Options

CreateOnBehalfGroup

1. When CreateOnBehalfGroup - SCSM - Employee End Users objects in list not  not available. I use script in attach with parameter  system.user, but access does not appear.
2. Why I set field CreateOnBehalfGroup group SCSM - Employee End Users in SCSM - administrator group field disappears. Help me please.

# set script parameter defaults  
param ([String]$Server = "localhost", [String]$RoleName = " Employee End Users", [String]$TypeToAdd)  
  
$a = [reflection.assembly]::LoadWithPartialName("Microsoft.EnterpriseManagement.Core")  
  
$m = new-object Microsoft.EnterpriseManagement.EnterpriseManagementGroup $Server   
  
# Get Type object  
#   Note:  If you need to get a list of all available classes related to (for example) “User”,   use this command:  
#               $m.EntityTypes.GetClasses() | ?{ $_.Name -like '*user*'} | %{ $_.Name}  
#  
$type = $m.EntityTypes.GetClasses() | ?{ $_.Name -eq $TypeToAdd}  
  
# Get role object, and insert the type GUID into scope  
$role = $m.Security.GetUserRoles()  | ?{ $_.DisplayName -eq $RoleName}  
$role.Scope.Objects.Add($type.Id)     
$role.Update()  
  
#   
# Get the value from the database again and validate it is there  
if ( $role.scope.objects.Contains($type.Id) ) {  
    write-host *** Successfully set the scope for role `" $role.DisplayName`" and it now contains all instances of $type.DisplayName `( $type.Name `)  
} else {  
    write-host "There was an error trying to insert the scope into the role."  
}  
 


<#
$TypeToAdd

$_.DisplayName = "System.User"
$_.Name = "Cireson.AssetManagement.CostCenter"
#> 
Sign In or Register to comment.