IT Management Suite

 View Only
  • 1.  Is this possible? Script to add device to filter

    Posted Aug 05, 2021 02:26 PM
    We are using Ivanti Neurons for a service desk solution at some point and wanted to see if this would be possible between altiris and neurons.

    We don't allow our 3rd party service desk access to the console, they only way they can add software to a device is by remoting to it, opening the software portal and adding the device. With neurons I can create task like buttons for our service desk and was thinking it may be nice if I could just have them add the pc to the filter from that console, we have old vbs for this in the console like 

    Set http = CreateObject("Microsoft.XmlHttp")
    http.open "GET", "acme.net/RemoveComputerFromFilter/MyService.asmx/Execute?varCompName=%COMPNAME%&FilterGUID=b28dc94a-75e8-49f0-95a7-4b9d314bb4ea", FALSE
    http.send ""
    WScript.Echo http.responseText

    Can I convert that to a powershell and have it run on a device, guessing the script would need to be run as someone who had access to altiris?


  • 2.  RE: Is this possible? Script to add device to filter

    Posted Aug 05, 2021 02:57 PM
    Edited by benjamin.barker Aug 05, 2021 04:25 PM

    Tested on 8.5 ru4. You should just need to update the 6 variables up top and change it to HTTP if you're not using https


    
    $ComputerName = 'computername'
    
    $ComputerDomain = 'domain'
    
    $FilterGuid = '620a51e9-71b6-4efa-b804-a4fc4b8733cb'
    
    $AltirisFQDN = 'yourNS.FQDN.com'
    
    $AltirisUserName = 'domain\username'
    
    $AltirisPassword = 'accountPassword'
    
    
    
    
    
    [securestring]$p = ConvertTo-SecureString $AltirisPassword -AsPlainText -Force
    
    [pscredential]$Creds = New-Object System.Management.Automation.PSCredential ($AltirisUserName, $p)
    
     
    
    $CollectionManagementService = New-WebServiceProxy -Uri "https://$AltirisFQDN/Altiris/ASDK.NS/CollectionManagementService.asmx" -Credential $Creds -ErrorAction Stop
    
    $ResourceManagementService = New-WebServiceProxy -Uri "https://$AltirisFQDN/Altiris/ASDK.NS/ResourceManagementService.asmx" -Credential $Creds -ErrorAction Stop
    
     
    
    try {
    
        $ComputerSearch = @($ResourceManagementService.GetComputerByNameAndDomain($ComputerName,$ComputerDomain))
    
    } catch {
    
        $_
    
    }
    
     
    
    if ($ComputerSearch.count -eq 0) {
    
       
    
        throw "Computer was not found."
    
     
    
    } else {
    
        try {
    
            #remove from filter
    
            #$CollectionManagementService.RemoveInclusions($FilterGuid,$ComputerSearch[0])
    
     
    
            #add to filter
    
            $CollectionManagementService.AddInclusions($FilterGuid,$ComputerSearch[0])
    
     
    
            #update #update #update filter membership
    
            $CollectionManagementService.UpdateCollections($FilterGuid)
    
        } catch {
    
            $_
    
        }
    
    }
    
     





  • 3.  RE: Is this possible? Script to add device to filter

    Posted Aug 05, 2021 03:54 PM
    That was super fast, I can't get it work but this may be issues with how neurons work but this gives me something to chip away at, thank you!


  • 4.  RE: Is this possible? Script to add device to filter

    Posted Aug 05, 2021 04:22 PM
    Sorry, I changed some variable names but it was still working because the variables were still set in my powershell session.  Try this one:

    
    $ComputerName = 'computername'
    
    $ComputerDomain = 'domain'
    
    $FilterGuid = '620a51e9-71b6-4efa-b804-a4fc4b8733cb'
    
    $AltirisFQDN = 'yourNS.FQDN.com'
    
    $AltirisUserName = 'domain\username'
    
    $AltirisPassword = 'accountPassword'
    
    
    
    
    
    [securestring]$p = ConvertTo-SecureString $AltirisPassword -AsPlainText -Force
    
    [pscredential]$Creds = New-Object System.Management.Automation.PSCredential ($AltirisUserName, $p)
    
     
    
    $CollectionManagementService = New-WebServiceProxy -Uri "https://$AltirisFQDN/Altiris/ASDK.NS/CollectionManagementService.asmx" -Credential $Creds -ErrorAction Stop
    
    $ResourceManagementService = New-WebServiceProxy -Uri "https://$AltirisFQDN/Altiris/ASDK.NS/ResourceManagementService.asmx" -Credential $Creds -ErrorAction Stop
    
     
    
    try {
    
        $ComputerSearch = @($ResourceManagementService.GetComputerByNameAndDomain($ComputerName,$ComputerDomain))
    
    } catch {
    
        $_
    
    }
    
     
    
    if ($ComputerSearch.count -eq 0) {
    
       
    
        throw "Computer was not found."
    
     
    
    } else {
    
        try {
    
            #remove from filter
    
            #$CollectionManagementService.RemoveInclusions($FilterGuid,$ComputerSearch[0])
    
     
    
            #add to filter
    
            $CollectionManagementService.AddInclusions($FilterGuid,$ComputerSearch[0])
    
     
    
            #update #update #update filter membership
    
            $CollectionManagementService.UpdateCollections($FilterGuid)
    
        } catch {
    
            $_
    
        }
    
    }
    
     ​


    ------------------------------
    Ben Barker
    Systems Engineer
    benjamin.barker@bmcjax.com
    ------------------------------



  • 5.  RE: Is this possible? Script to add device to filter

    Posted Aug 05, 2021 05:06 PM
    You sir made my day, adding to devices to filters now from neurons, thank you!


  • 6.  RE: Is this possible? Script to add device to filter

    Posted Aug 05, 2021 04:41 PM
    I was wondering if you could tell me one thing, just playing with this in altiris and it works to add the device but I keep getting a popup that wants my username and password twice, what do I have wrong in here to get that not ask for them

    $ComputerName = $env:computername

    $ComputerDomain = 'OURdomain'

    $FilterGuid = '{ac7209c6-1491-4edd-ab9c-bd00f2b14311}'

    $AltirisFQDN = 'smp1-awh.ourdomain'
    $AltirisUserName = 'ourdomain\mysuername'
    $AltirisPassword = 'mypassword'



    [securestring]$p = ConvertTo-SecureString $ppt -AsPlainText -Force

    [pscredential]$Creds = New-Object System.Management.Automation.PSCredential ($u, $p)



    $CollectionManagementService = New-WebServiceProxy -Uri "https://$AltirisFQDN/Altiris/ASDK.NS/CollectionManagementService.asmx" -Credential $Creds -ErrorAction Stop

    $ResourceManagementService = New-WebServiceProxy -Uri "https://$AltirisFQDN/Altiris/ASDK.NS/ResourceManagementService.asmx" -Credential $Creds -ErrorAction Stop



    try {

    $ComputerSearch = @($ResourceManagementService.GetComputerByNameAndDomain($ComputerName,$ComputerDomain))

    } catch {

    $_

    }



    if ($ComputerSearch.count -eq 0) {



    throw "Computer was not found."



    } else {

    try {

    #remove from filter

    #$CollectionManagementService.RemoveInclusions($FilterGuid,$ComputerSearch[0])



    #add to filter

    $CollectionManagementService.AddInclusions($FilterGuid,$ComputerSearch[0])



    #update filter membership

    $CollectionManagementService.UpdateCollections($FilterGuid)

    } catch {

    $_

    }

    }