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