Product: PowerShell Universal
Version: 1.5.2 - latest official build
so, i don’t know what happed, but UA server really eats the memory.
searched the logs, nothing strange there.
what might be the cause ?
Product: PowerShell Universal
Version: 1.5.2 - latest official build
so, i don’t know what happed, but UA server really eats the memory.
found the problem here in roles.ps1.
this is the code
New-PSURole -Name "Administrator" -Description "Administrators can manage settings of UA, create and edit any entity within UA and view all the entities within UA." -Policy {
param(
$User
)
#
# Policies should return $true or $false to determine whether the user has the particular
# claim that require them for that role.
#
$UserName = ($User.Identity.Name)
$UserName = $UserName.Substring($UserName.IndexOf('\')+1,($UserName.Length -($UserName.IndexOf('\')+1)))
$IsMember = $false;
# Perform LDAP Group Member Lookup
$Searcher = New-Object DirectoryServices.DirectorySearcher
$Searcher.SearchRoot = 'LDAP://DC=edit,DC=edit,DC=edit' # INSERT ROOT LDAP HERE
$Searcher.Filter = "(&(objectCategory=person)(memberOf=CN=edit_team-IT,OU=edit,OU=edit,OU=edit,OU=edit,OU=edit,DC=edit,DC=edit,DC=edit))" #GROUP INSERT DN TO CHECK HERE
$Users = $Searcher.FindAll()
$Users | ForEach-Object{
If($_.Properties.samaccountname -eq $UserName)
{
$IsMember = $true;
#"$UserName is a member of admin group!"
}
else {
#write-host "$UserName is NOT member of admin group!"
}
}
return $IsMember
#$true
}
the ad group has like 15 members. what am i doing wrong here ? every time someone opens a window of the dashboard, the dashboard adds like 100 mb to the memory. on the dashboard i only have one page that uses roles which is this
$Pages += New-UDPage -Name "Admin" -content{
New-UDGrid -Container -Content {
New-UDGrid -Container -Content {
New-UDPaper -Content {
New-UDTypography -Text $User
} -Elevation 2
}
}
} -Role 'Administrator'
Please help.
The DirecorySearcher and SearchResultCollection are disposable. You will likely want to dispose of them in your roles.ps1 script.
param(
$User
)
#
# Policies should return $true or $false to determine whether the user has the particular
# claim that require them for that role.
#
$UserName = ($User.Identity.Name)
$UserName = $UserName.Substring($UserName.IndexOf('\')+1,($UserName.Length -($UserName.IndexOf('\')+1)))
$IsMember = $false;
# Perform LDAP Group Member Lookup
$Searcher = New-Object DirectoryServices.DirectorySearcher
$Searcher.SearchRoot = 'LDAP://DC=edit,DC=edit,DC=edit' # INSERT ROOT LDAP HERE
$Searcher.Filter = "(&(objectCategory=person)(memberOf=CN=edit_team-IT,OU=edit,OU=edit,OU=edit,OU=edit,OU=edit,DC=edit,DC=edit,DC=edit))" #GROUP INSERT DN TO CHECK HERE
$Users = $Searcher.FindAll()
$Users | ForEach-Object{
If($_.Properties.samaccountname -eq $UserName)
{
$IsMember = $true;
#"$UserName is a member of admin group!"
}
else {
#write-host "$UserName is NOT member of admin group!"
}
}
$Searcher.Dispose()
$Users.Dispose()
return $IsMember
#$true