0 votes

Dear Adaxes support,
can you please advise if there an option to release memory, used by Adaxes service?
I'm facing an issue with 2019.1 that after custom task execution (connecting to SCCM server and getting some data) on a 1K computer Business Unit- Adaxes service is using up 99% of RAM and even if custom command finished executing - it's not letting go :)
I've read through similar cases, my logDB is just 60Mb, I've introduced try/catch blocks for connections, the issue persists. As command is executed over the BU - RAM consumption grows.
From my point of view - it's fine if it consumes RAM, but it should let it go when done... or not?
Maybe you can advise a way to optimize?
Here's my script:

 \#Load Configuration Manager PS module from local SCCM admin console installation  
 $ConfigMgrModulePath="C:\\Program Files (x86)\\Microsoft Configuration Manager\\AdminConsole\\bin\\ConfigurationManager.psd1"  
 Import-Module $ConfigMgrModulePath -ErrorAction SilentlyContinue  
 cd "$((Get-PSDrive -PSProvider CMSite).Name):"  

 $computer=$Context.BindToObjectEx($Context.TargetObject.AdsPath , $True)  
 \#Get SCCM ClientActiveStatus and put in object attribute  
 try{  
  $computer.Put("adm-CustomAttributeBoolean40",\[System.Convert\]::ToBoolean((Get-CMDevice -Name $Context.TargetObject.Get("Name")).ClientActiveStatus))  
  $computer.SetInfo()  
 }  
 catch{  
  $Context.LogMessage("No client status found", "Information")  
 }  
 try{  
 \#Get SCCM LastLogonUser (pre-Windows2000)  
 $SCCMLastLogonName = ((Get-CMDevice -Name $Context.TargetObject.Get("Name")).LastLogonUser).ToString()  
 \#Get name of account  
  $LastLogonName =(Get-AdmUser -Filter 'SamAccountName -eq $SCCMLastLogonName').Name  
  $computer.Put("adm-CustomAttributeText30",$LastLogonName)  
  $computer.SetInfo()  
 }  
 catch{  
  $Context.LogMessage("No last logon name found", "Information")  
 }  
 try{   
  $computer.Put("adm-CustomAttributeDate5",((Get-CMDevice -Name $Context.TargetObject.Get("Name")).LastClientCheckTime))  
  $computer.SetInfo()  
 }  
 catch{  
  $Context.LogMessage("No last client last check data found", "Information")  
 }  
 \#Get list of user affinity  
 try{  
  $PrimaryUsers = (Get-CMUserDeviceAffinity -DeviceName $Context.TargetObject.Get("Name")).UniqueUserName -split " "  
 }  
 catch{  
  $Context.LogMessage("Couldn't get affinity information", "Information")  
 }  
 if($PrimaryUsers.count -gt 0){  
  foreach ($PrimaryUser in $PrimaryUsers){  
 \#Remove domain prefix  
  $PrimaryUser = $PrimaryUser.Split('\\')\[1\]  
 \#If user affinity matches last logon user - set as primary user for computer  
  if(($PrimaryUser -eq $LastLogonUser) -and (-Not \[String\]::IsNullOrEmpty($PrimaryUser))){  
  $PrimaryUserDN=(Get-AdmUser -Filter 'SamAccountName -eq $PrimaryUser').DistinguishedName  
  $computer.Put("seeAlso", $PrimaryUserDN)  
  $computer.SetInfo()  
  }  
  }  
 }  
 Remove-Module $ConfigMgrModulePath -ErrorAction SilentlyContinue

Thanks,
Dmytro

by (920 points)
edited by
0

Dear Adaxes support,
I did some script modification, but it's generally not solving the issue.
As the script is running of Business Unit - it increases RAM used by Adaxes Service. When script stops - the memory is not released.
Also we did monitoring and noticed that something is going on in background - CPU jumps at a level 5-10% and RAM consumed by Adaxes service grows. Over the day it takes all free space, this morning I had it having 10Gb.
This was not happening on 2018.2.
Can you please get back to me regarding this issue?
P.S. Updated script, through I don't think it's related any more.

 Import-Module ConfigurationManager -ErrorAction SilentlyContinue  
 import-Module Adaxes  

 cd "$((Get-PSDrive -PSProvider CMSite).Name):"  

 $computer=$Context.BindToObjectEx($Context.TargetObject.AdsPath , $True)  

 try{  
  $SCCM\_data = Get-CMDevice -Name $Context.TargetObject.Get("Name")| Select-Object ClientActiveStatus, LastLogonUser, LastClientCheckTime  
 }  
 catch{  
  $Context.LogMessage("Couldn't get info from SCCM", "Information")  
 }  

 $LastLogonName =(Get-AdmUser -Filter "SamAccountName -eq '$($SCCM\_data.LastLogonUser)'").Name  
 $computer.Put("adm-CustomAttributeText30",$LastLogonName)  
 $computer.Put("adm-CustomAttributeBoolean40",\[System.Convert\]::ToBoolean($SCCM\_data.ClientActiveStatus))  
 $computer.Put("adm-CustomAttributeDate5",$SCCM\_data.LastClientCheckTime)  
 $computer.SetInfo()  


 \#Get list of user affinity  
 try{  
  $PrimaryUsers = (Get-CMUserDeviceAffinity -DeviceName $computer.Get("Name")).UniqueUserName -split " "  
 }  
 catch{  
  $Context.LogMessage("Couldn't get affinity information", "Information")  
 }  

 foreach ($PrimaryUser in $PrimaryUsers){  
  #Remove domain prefix  
  if(-Not \[String\]::IsNullOrEmpty($PrimaryUser)){  
  $PrimaryUser = $PrimaryUser.Split('\\')\[1\]  
  #If user affinity matches last logon user - set as primary user for computer  
  if(($PrimaryUser -eq $LastLogonUser) -and (-Not \[String\]::IsNullOrEmpty($PrimaryUser))){  
  $PrimaryUserDN=(Get-AdmUser -Filter 'SamAccountName -eq $PrimaryUser').DistinguishedName  
  $computer.Put("seeAlso", $PrimaryUserDN)  
  $computer.SetInfo()  
  }  
  }  
 }

1 Answer

0 votes
by (216k points)
selected by
Best answer

Hello Dmytro,

The script itself should not cause memory leaks. However, the script is written so that the operations performed on the computer objects go through Adaxes pipeline. It means the script execution can trigger other processes in Adaxes which might cause memory leaks (e.g. actions in the Business Rules configured to trigger Before/After Updating a Computer). Thus, you should check if there are such processes configured in your environment. The General log of Adaxes might contain information which could help you to find the cause of the issue. For information on how to check the log, have a look at the following help article: https://www.adaxes.com/help/?Logging.Vi ... eLogl.html.

Also, could you, please, post here or send us (support[at]adaxes.com) the length of Adaxes Command Queue. For information on how to view the queue, have a look at the following post on our forum: 2018.2 Adaxes Service High Memory Usage.

Related questions

0 votes
1 answer

Hello, I have a scheduled task running daily at 1am. After that the Softerra.Adaxes.Service.exe process is using most of the available memory and brings the server to ... the remote session and release resources if ($session) { Remove-PSSession $session } }

asked Jun 14, 2019 by ryan_breneman (920 points)
0 votes
1 answer

Since upgrading to 2018.2 we are experiencing an issue where the Softerra.Adaxes.Service will consume all of the OS's available memory causing it to become unresponsive. ... for the service or figure out what might be causing the high memory utilization?

asked Nov 2, 2018 by yourpp (540 points)
0 votes
1 answer

Pretty easy to replicate. On the Adaxes server, you can use Powershell to send to that SMTP server so we know it's not a firewall issue: $myCredential = Get- ... packet capture shows the Adaxes server doesn't issue either an EHLO or a STARTTLS command.

asked Jun 28 by ngb (290 points)
0 votes
1 answer

Hi We have Adaxes (3.15.21009.0) set up in HA across 2 back end servers. I am just working on a simple script, connecting from a seperate box to one of the BE ... is doing to help identify why the service is taking all the compute of this server? Thanks Matt

asked May 2, 2023 by chappers77 (2.0k points)
0 votes
1 answer

Hi I'm testing 2023 and have noticed that the admin console keeps grabbing memory. This seems to be happening when editing powershell scripts in scheduled tasks ... $purpose = Get-UnifiedGroup -Identity Disconnect-ExchangeOnline Is this a known problem? Matt

asked Nov 30, 2022 by chappers77 (2.0k points)
3,547 questions
3,238 answers
8,232 comments
547,810 users