1 2 Previous Next 16 Replies Latest reply on Mar 16, 2018 1:32 PM by markdevr

    MBSDK-AddDeviceToScheduledTask return false

    Thomas56 Rookie


      I can’t add a computer to a scheduled task using the MBSDK.


      This Powershell return false :

            $landeskService = New-WebServiceProxy -Uri  http://coresrv/MBSDKService/MsgSDK.asmx?WSDL -UseDefaultCredential



      And direct HTTP request  "http://core/MBSDKService/MsgSDK.asmx/AddDeviceToScheduledTask?taskId=170&deviceName=PCNAME"

      return :

           <?xml version="1.0" encoding="UTF-8"?>

           <boolean xmlns="http://landesk.com/MBSDKService/MBSDK/">false</boolean>



        • 1. Re: MBSDK-AddDeviceToScheduledTask return false
          michael.odriscoll SupportEmployee

          Hi Thomas,


          Thanks for your message.


          Were you able to resolve this? Please share anything you deem useful here with the Community.



          • 2. Re: MBSDK-AddDeviceToScheduledTask return false
            Thomas56 Rookie

            Hi Michael,

            At now, I don’t found any solution.


            I can’t spend time on this point, then I work in other way.





            • 3. Re: MBSDK-AddDeviceToScheduledTask return false


              Sorry for the late response, I am trying to build up my MBSDK skills as well.  I dont know if you had tried this or not; but before you call the AddDeviceToScheduledTask method; did you try calling ResolveScopeRights?


              Should look like (based on your example above:




              So full rundown should look similar to:

                    $landeskService = New-WebServiceProxy -Uri  http://coresrv/MBSDKService/MsgSDK.asmx?WSDL -UseDefaultCredential




              HTH -- if you have gleaned any other data about the MBSDK please post about it



              • 4. Re: MBSDK-AddDeviceToScheduledTask return false
                Thomas56 Rookie

                Hi Jay,

                No change :

                $landeskService.ResolveScopeRights()  return true, and Add Device... false



                • 5. Re: MBSDK-AddDeviceToScheduledTask return false


                  For the user you are running this script as, are they inheriting all the scopes from other groups? and do not have any scopes explicitly assigned?


                  I had the same issue as you, when attempting to run the scripts with my admin account... noticed it did not have any explicitly assigned scopes and was inheriting them from other groups.  I explicitly added the "All Devices" scope to my admin account and that allowed me to add a device to a task in my task list.  I have not tried public, or other users tasks... but baby steps...


                  I hope this helps...

                  Good Luck!


                  • 6. Re: MBSDK-AddDeviceToScheduledTask return false

                    I'm kind of new to this part. How could the script be written so the task is hard coded but the PC name isn't. I was checking out the MBDSK information on another article. Just not that far along. So far this works:

                    $where = 'http://corename/mbSDKService/MsgSDK.asmx?WSDL'

                    $Creds = Get-Credential

                    Try { 

                        $WebService = New-WebServiceProxy -uri $where -Credential $Creds 

                    Catch { 

                        # Error handling goes in here 



                    So I also tried this and it works for me as well. I get two True and it adds my device name. I am using a public task and the process itself is working.

                    $landeskService = New-WebServiceProxy -Uri  http://CORENAME/MBSDKService/MsgSDK.asmx?WSDL -UseDefaultCredential




                    I'd still though like to figure out how to do it without hardcoding the devicename in the script though.

                    • 7. Re: MBSDK-AddDeviceToScheduledTask return false

                      Hi jbramson,


                      i think the simplest solution for you would be to read the device name from the host.


                      Should work something like:


                      #Declare Varaible to hold device name

                      $DeviceName = $null


                      #Read Device Name from Host

                      $DeviceName = Read-Host "Enter Device Name"


                      then change the call for AddDeviceToScheduledTask to look like this:



                      Now... it could still error out if the device name entered doesn't match a device in the calling users scope or if the device name is misspelled.


                      You could also do something similar with taskID





                      ***edited for missed item on the read-host line ***

                      • 8. Re: MBSDK-AddDeviceToScheduledTask return false

                        That would work or some variation I saw if I wanted to have the user on their device run the PS script. I am trying to set it up as an easy process for techs to add a device with a PS script though that aren't on the PC. I have a code snippet I got to pop a dialog box to pass the parameter back to the script and it could possibly be done that way. It's just not as clean as I would like it for now. So was wondering if someone had a cleaner way that can code better than I can.

                        • 9. Re: MBSDK-AddDeviceToScheduledTask return false
                          phoffmann SupportEmployee

                          Couple of things:


                          1 - Keep an eye on this article (especially folks getting started) - it may lend you some help along the way -- Getting Started with the MBSDK (Example Scripts Included) -- I included a bunch of "copy and paste" type examples to help folks along .


                          2 - Please state what version of LANDesk ManagementSuite and what ServicePack you're on.


                          ==> MBSDK issues *do* get treated as regular defects and do get fixed with service packs / the service updates. It's possible that you "just need to update" if you happen to be on a really old version, for instance.


                          So that's why it's important to let us know where you're at -- if nothing else, we can compare apples to apples.


                          3 - MBSDK defects (if they can be duped) are just that ... regular support calls. So don't shy away from logging them with support if need be. (This isn't me giving you teflon shoulders, I'm just highlighting that MBSDK stuff doesn't get treated any different if it doesn't do what it's supposed to do).


                          4 - If you're having trouble with the script -- trying calling the MBSDK directly. Benig a SOAP based API, it has a nice, easy to use WSDL access point. So you can just open a browser, authenticate (NT authentication) and go to (assuming you're on the Core):

                          -- http://localhost/MBSDKService/MsgSDK.asmx


                          ... and check if the operation works "by hand". If it does, then it's not necessarily a problem with the MBSDK but could be one with the script. Handily, you get expected results in XML format ... so let's try adding a device I know exists (based on COMPUTER_IDN) to a scheduled task I created.


                          NOTE - for reference, I'm on a 2016.3 Core with SU3 installed (which currently has to be requested from support, if I'm not mistaken).


                          So - let's look at our www-service in a Browser:

                          -- http://localhost/MBSDKService/MsgSDK.asmx?op=AddDeviceToScheduledTask


                          ... which gets us the following:

                          1 - AddDeviceToTask. - Basicjpg.jpg


                          I have the following:

                          - A task (TASK_IDN of 14)

                          - A device I want to add (with COMPUTER_IDN of 99 -- with a device name of "TIAMAT")


                          So let's fill that out & hit the "go forth and do it" button.

                          2 - AddDeviceToTask. - Adding.jpg


                          ... what happens next? A new browser tab opens up with our response. Which in this case is "True" (yay) ... so that worked fine!

                          3 - AddDeviceToTask. - Added done.jpg


                          ... so - how does this help you? Well - go forth and do the following:


                          1 - Log on to the MBSDK as the admin (I assume you're an admin?) and repeat the above steps with a valid device name & a valid task ID.

                          2 - Check if THAT works.

                          3 - If it DOES ... great. Means your problem is in your script.


                          ... CHANCES are that it's to do with the NT authentication (or lack thereof). I'd strongly suggest using pass-through credentials (that way, you can use a Windows Scheduler task to store your desired credentials for instance) ... or make sure to prompt for them & enter them ... see if it works then.


                          Remeber that RBA *still applies* ... try a public task first. If THAT works, you're probably getting tripped up by "hey - your user doesn't have permission to either the device (out of scope) and/or the task!" ... so give it a go as a "full admin" and go from there.


                          Hope that helps .

                          1 of 1 people found this helpful
                          • 10. Re: MBSDK-AddDeviceToScheduledTask return false


                            I apologize I just re-read that and realized I most likely didn't explain my self properly:


                            if you use the following two lines of code:

                            $DeviceName = $null

                            $DeviceName = Read-Host "Enter Device Name"


                            it will prompt the user to enter the device name like shown below:

                            Then you just have the end user add whatever they want in the window..  yes a little form would be nicer and is doable... but i dont have the code handy to post... I'll see if i can't dig something up.




                            • 11. Re: MBSDK-AddDeviceToScheduledTask return false

                              Hey phoffmann,

                              Thanks for the great post (you have quite a few good ones on here I refer to regularly.  I noticed with my testing; that even as a LANDESK admin I had to explicitly assign the user a scope else the MBSDK.log kept saying the device was out of the users scope.


                              As soon as I explicitly assigned a scope to the user everything started working.  not sure how MBSDK handles nested permissions/scope assignments.




                              • 12. Re: MBSDK-AddDeviceToScheduledTask return false
                                phoffmann SupportEmployee

                                It "should" handle it in the same way that the console does ... but sometimes nesting can cause "interesting" effects.


                                Direct / explicit assignments can be useful. Not something I myself have stumbled across in my lab, but I've seen similar things at a customer, come to think of it (I *suspect* it could be down to a GPO, which is a mite difficult to nail down, by and large) .


                                Hopefully that means you're unstuck now .


                                As a heads-up, the MBSDK is mainly in a "maintenance only" mode now (as in - we'll fix defects) as the "proper SDK" (called "LDAPI") nowadays is a REST-ful set of stuff, which is used in Workspaces for instance. As I have tie (... one can hope ) I am slowly trying to come up with an article for *THAT* too (similar to the MBSDK one) ... one of several pet projects for the coming months ... .

                                • 13. Re: MBSDK-AddDeviceToScheduledTask return false

                                  You are correct.. it can get "interesting" and I am now unstuck for the MBSDK method... adding/removing devices from task, starting tasks...  however looks like i need to learn something new


                                  Figures... as I start to grasp one method a new one rears its head...  Such is life.  Is there any documentation for the LDAPI? Since I am just starting; its probably a good time to learn the new stuff.


                                  WHEN that new article shows up, I will definitely read it





                                  • 14. Re: MBSDK-AddDeviceToScheduledTask return false
                                    Thomas56 Rookie



                                    Great ! As you I explicitly added the "All Devices" scope to my admin account, and now it's OK.




                                    1 2 Previous Next