1 2 Previous Next 17 Replies Latest reply on Aug 26, 2011 1:20 PM by EMiranda

    LANDesk Management SDK Problem


      I'm trying to utilize the SDK function for DeleteComputerByIPName.


      I am calling the web service located here:  http://<coreserver>/MBSDKService/MsgSDK.asmx?op=DeleteComputerByIPName


      The problem that I  am coming up against is that the return codes don't seem to make sense.  When I pass it a machine name, it sometimes will return a 1 or a 2 which is fine.  But the ones that com eback with a 2 are actually valid machines in the database.  I have tried the FQDN the short name, the IP address and can't seem to get rid of them.


      It does seem to have something to do with name resolution.  If the name resolves fine via DNS it gets deleted.  If not, then I get a 2.  Unfortunately many of these machines have been "gone" for a while and are no longer in AD or DNS.


      Does anyone have any experience with this particular function?

        • 1. Re: LANDesk Management SDK Problem

          No one uses the SDK?


          We are attempting to sync our LANDesk inventory with our AD environment.  So we are pruning machines that are no longer here out of LANDesk.


          Here is the command we are using via powershell.


          $computer = "computername"

          $deletecomputer = New-WebServiceProxy -uri http://<coreserver./MBSDKService/M
          sgSDK.asmx?wsdl - credential <credential>

                  write-host $computer


          As I said, it returns a "2" even though the machine is indeed in the database.

          • 2. Re: LANDesk Management SDK Problem
            EMiranda Expert

            I understand what you are trying to do, but why dont you use the "days to keep inventory scans" setting on the core.  If a machine doesnt check into LANDesk by x amount of days like 30 days then it will clear out of your LANDesk inventory automatically.

            • 3. Re: LANDesk Management SDK Problem

              We do that as well, but often we send hundreds of machines back for a lease replacement and we KNOW they need to be deleted.  Since this happens often, is often difficult to make an ad-hoc LD group and delete them.


              So we have them delete them out of AD and then expect LD to delete them.   Otherwise our patch reports, compliance, etc all show a large number of machines that are actually gone as having old data on them.

              • 4. Re: LANDesk Management SDK Problem
                EMiranda Expert

                how do you get the info for the machines that are sent back? does it come in a spreadsheet or something?

                • 5. Re: LANDesk Management SDK Problem

                  I query our AD and then LANDesk and have a list of machines that are in LANDesk but are not in AD.


                  The beginning is a simple text file.  In this case though, all I'm trying to get done is delete one machine from LANDesk.

                  • 6. Re: LANDesk Management SDK Problem



                    the only acceptable parameter for the DeleteComputerByIPName is the FQDN.

                    So using the numeric ip or short name will never work.

                    Returns 1 if is succesfull, 2if the computer does not exists, -1 if there are some errors.

                    Check that the Network -> TCPIP -> Hostname matches the one that you want to delete.

                    If you delete the same machine that you are not able to delete via IP Name using the GUID using the DeleteComputerByGUID works or not?

                    And it you delete the machine manually and you refresh the view ? Is the machine deleted or returning back?

                    Maybe the problem is deleting the machine itself (some DB issue) and not the SDK.

                    Kind regards,


                    • 7. Re: LANDesk Management SDK Problem

                      I will try the HOSTNAME, but I have tried the IP, the short name, and the FQDN and wasn't successful.  Deleting from the console worked ok.



                      • 8. Re: LANDesk Management SDK Problem

                        Here's what I got:






                        Here's what it looks like in the console.




                        As you can see, its in the console, but still giving me a "2" when attempting to delete.


                        • 9. Re: LANDesk Management SDK Problem



                          Are you using SQL server or ORACLE?

                          Anyway try again with the FQDN.

                          The name (string) that is taken in consideration  from the SDK function is not the machine name but the Host Name.

                          You can find this attribute in the machine inventory under Network -> TCPIP -> Host Name

                          in the database is in the table TCP, field HOSTNAME.

                          This is the query that the SDK method send to the database:


                          exec sp_executesql N'select Computer_Idn from Tcp where HostName = @P1 ',N'@P1 nvarchar(18)',N'alm-mig.colour.prv'


                          where in this case alm-mig.colour.prv is the host name of the machine that I want to delete.

                          The Host Name in the inventory is here:




                          Kind regards,


                          • 10. Re: LANDesk Management SDK Problem

                            Thanks for the response.


                            The host name is indeed the FQDN in the field you had me look in.  Although, when I modified the statement it still returns a "2".  Also the SQL statement returns nothing as well.


                            I looked up the DeviceID and found that the name in the table TCP is the same as I was attempting to delete.  I even matched the case as well.




                            hostname from tcp where Computer_Idn = '10178'

                            • 11. Re: LANDesk Management SDK Problem



                              that is really strange.

                              Please try this query:


                              select * from Tcp where HostName like 'your-hostname%'

                              If you do not find your device it is possible that for some strange reason the inventory of that device is corrupted and the TCP table was for some strange reason not correctly populated.

                              Kind regards,


                              • 12. Re: LANDesk Management SDK Problem

                                It returns an appropriate line.



                                * from Tcp where HostName like 'LSV-1094404%'


                                6535 6535 LSV-1094404 No No No NULL NULL NULL NULL NULL NULL NULL NULL NULL


                                When I run this though,


                                $computer = "LSV-1094404"

                                $deletecomputer = New-WebServiceProxy -uri http://omac-inapland01/MBSDKService/MsgSDK.asmx?wsdl -credential $c

                                write-host $computer

                                I get this.


                                PS H:\Junk1> .\delete-one-computer.ps1

                                Security Warning
                                Run only scripts that you trust. While scripts from the Internet can be useful,
                                this script can potentially harm your computer. Do you want to run
                                [D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): r
                                PS H:\Junk1>


                                • 13. Re: LANDesk Management SDK Problem
                                  Catalysttgj Expert

                                  I have a way simpler solution that we use whenever we need to cook out LD records, and its useful for many other scenarios besides this one. We use a small script that creates an importable XML file for an LDMS query that simply lists all the devices desired. The script offers various input as well such as IP address, name, user logon name, and a few others. The basic idea is that it builds a simple xml file, and then you just import the result into the LDMS console. Run the query, blam... you got a list. Then you can do what you want with this list. No need for this complex SDK stuff.


                                  consider this as a solution to get to the same result, and probably faster too, plus once you have this sort of mechanism, you'll think of a eleventy billion other uses for it.



                                  • 14. Re: LANDesk Management SDK Problem

                                    We utilize this group import as well.  The problem is, that I want this to be automatable and we need to do it at least weekly as people delete AD objects daily somewhere in the company.


                                    That is a good idea though, but not able to be scripted.

                                    1 2 Previous Next