Loading

Echo

Skip Feed
  1. Requesting Computer Name
    Hello. I have a rather complicated issue and question but everyone was so helpful with my last question I'm hopeful. My companies Active Directory tree is sort of a mess some of it caused by design and other by acquisition. We have multiple trees joined by trusts and a few trees with little or no connection as they are isolated secure environments. We originally tried to use the Reverse DNS look up to find the Requesting Computer Name but quickly realized that when requesting for machines in other AD trees the reverse DNS would not work. We are able to deploy software to the other environments by utilizing SCCM connection to those trees. We had Snow create a Powershell Web Service to query SLM for the computer names associated with the users as we have Gateway servers placed in the other AD environments feeding discovery information to SLM. The Powershell works fairly well but it requires that the end user know the domain they are requesting the software in. This is not the ideal state but really causes issues for the Apple machines as they appear as if they are local accounts in SLM so the user would have to populate the machine name\userid. I would like to resolve this issue and make the user experience better for the non Apple users by figuring out away to not require the domain. Is there away to use a wildcard in the API call (Ex: %\userid). Below is the Powershell were using.  Thanks!!! Jerry function SLM_Computers   {   param($slmuser) $apiAccountName = Get-APSetting "SLMApiAccountName"   $SLMServerName = Get-APSetting "SLMServerName"   $SLMCustomerId = Get-APSetting "CustomerId"     $apiUserAccount = Get-ServiceAccount -Name "$apiAccountName" -Scope 1   $securePassword = ConvertTo-SecureString $($apiUserAccount.Password) -AsPlainText -Force   $credential = New-Object Management.Automation.PSCredential ($($apiUserAccount.AccountName), $securePassword)   $user = "***"   $version = 8   $secpasswd = ConvertTo-SecureString “***” -AsPlainText -Force   $customer = "1"   $SLMServerName = "****"   $credential = New-Object System.Management.Automation.PSCredential ($user, $secpasswd)   #$username = "centene\jyarbrough"   #$slmuser= $username function GetAPIFilterUri { Param([string]$username) return " http:// " + $SLMServerName + "/api/customers/1/users/?`$filter=Username%20eq%20%27"+ $username + "%27&`$top=1&`$format=json"   } function GetUserByUserNameWithFilter{   Param([string]$username) $body = Invoke-RestMethod -Uri (GetAPIFilterUri -username $username) -Method Get -Credential $credential $u = $body.Body return $u.Body   } function GetUserByUserName{   Param([string]$username) $body = Invoke-RestMethod -Uri $slmhost -Method Get -Credential $credential $u = $body.Body | ? {$_.Body.Username -like "*$username*"} return $u.Body   }     function GetUserByUserNameLinkComputers {   Param([string]$userid) $url = " http:// " + $SLMServerName + "/api/customers/1/users/" + $userid + "/?`$format=json"   $body = Invoke-RestMethod -Uri $url -Method Get -Credential $credential return ($body.Links | ? {$_.Rel -like "*Computers*"})   } $un = "$slmuser" $user = GetUserByUserNameWithFilter -username $un $usercomplinks = GetUserByUserNameLinkComputers -userid $user[0].Id.ToString()   function GetComputersFromUserLink{   Param([string]$compurl) $body = Invoke-RestMethod -Uri $compurl -Method Get -Credential $credential return $body.Body   }   function GetListOfComputerNamesFromUserUrl {   Param([string]$url) $complist = @() $comps = GetComputersFromUserLink -compurl $usercomplinks.Href $justcomps = $comps| ? {$_.Body.OperatingSystem -notlike "*server*"}     #echo $justcomps.Body ForEach($comp in $justcomps) {   [string]$n= $comp.Body.Name $n   }   return $complist   } $cl = GetListOfComputerNamesFromUserUrl   $cl   }
    Expand Post

    • Oskar Frolin (Flexera Software)

      Hi Jerry, I can't confirm right now but you could possibly do a "like" or similar in the SLM filtered api query (.....ilter=Username%20eq%20%27".... -> ....ilter=Username%20like%20%27"....). If you browse the SLM API to that endpoint you should get some help on editing that query. But another "solution" would be if you had for example every user as manager or any other ad attribute in Active Directory, and did a direct check to that value. This would be a "simpler" technical solution, but would require you to feed that data into AD if it's not already there. /Oskar
      Expand Post

End of Feed
1 Chatter Feed Items
ALL CONVERSATIONS
UNSOLVED
ARTICLES
1 Post

Related Topics

    Loading
    Echo | Flexera