10 Replies Latest reply on Jul 26, 2016 2:45 AM by phoffmann

    Script a Provisioning template(s) to run automatically?

    Apprentice

      Hi all

       

      We are having sporadic problems deploying our standard apps as LDAP-integrated Scheduled Tasks to new builds using LDMS 9.0 SP3 (8.8 SP4 works fine). LANDesk Support have tried but failed to resolve it. So we now have Provisioning working fine in 9.0 SP3 by adding the following command to our GuiRunOnce scripts:-

       

      ldProvision.cmd

      \\server\ldlogon\provisioning\windows\ldProvision.exe -l C:\Temp\LDProv.log -V 255

       

      This asks for credentials and the which Provisioning template and Delivery Method to use.

       

      Is there any way to automate the entry of the credentials and selection of the required Provisioning template and Delivery Method please?

       

      Thanks

      Scott

        • 1. Re: Script a Provisioning template(s) to run automatically?
          Employee

          If the task is prescheduled it shouldn't need credentials.  It will just pick up and run.  Are you using OSD to deploy the OS and then want to use provisioning after?  Is there a reason you aren't running a full end to end provisioning template for this?

           

          I'm not sure exactly what you're trying to accomplish.  Also, will you be going to 9.5 any time soon.  You're a few versions behind, even after getting to 9.0 SP3.

          • 2. Re: Script a Provisioning template(s) to run automatically?
            LANDeskWizrd SSMMVPGroup

            There is a way to do what you are asking. You would have to script the commands using SOAP calls. If you don't have prior knowledge of SOAP or MBSDK then doing some research will help. We currently do this same exact thing after we image a machine via OSD.

            1 of 1 people found this helpful
            • 3. Re: Script a Provisioning template(s) to run automatically?
              Apprentice

              Mach6, we are using OSD to deploy the OS and then using Provisioning to install our 'standard apps'. We want to move to 9.5 in time but didn't want to spend time creating/testing a full end-to-end Provisioning template, which will also have a training impact.

               

              LANDeskWizrd, we will look into this, thanks for the heads-up.

              • 4. Re: Script a Provisioning template(s) to run automatically?
                Frank Wils ITSMMVPGroup

                Hi,

                 

                http://community.landesk.com/support/thread/7510?start=0&tstart=0

                Look here for more info. From the top of my mind though, don't use "computer.Device name", but "computer.display name".

                 

                Frank

                • 5. Re: Script a Provisioning template(s) to run automatically?
                  Apprentice

                  Thanks Frank. I don't have any experience with SOAP or MBSDK and trying to find how to do this is proving difficult. Do you have any code you can share with us to help please?

                   

                  Scott

                  • 6. Re: Script a Provisioning template(s) to run automatically?
                    Frank Wils ITSMMVPGroup

                    Scott,

                     

                    Sure, Here is a template for a vbscript i use for 'self-service imaging through the Software Portal, but you can change this easily to start in PE for example. You start it by running this vbs with the Template ID as command line parameter, in the script is the link to get the Template ID's. Also, read through the script and Replace the necesarry variables with your own values. In the script is a refence to a user/password. Create a user with minimal rights of course, even better a local user on the Core, with just Provisioning rights.

                     

                    The starttime can be in the past, or you can use Start Now, to start the scheduled task immediately.

                     

                    Frank

                     

                    Start script:

                    -------------------------------------------------------------

                     

                    'http://YOURSERVER/MBSDKService/MsgSDK.asmx/GetProvisioningTemplates

                     

                    set WSHShell = wscript.createObject("wscript.shell")

                     

                    if WScript.Arguments.Count > 0 then

                                    ReDim aComputers(WScript.Arguments.Count-1)

                                    For i = 0 to (WScript.Arguments.Count-1)

                                                   StrTemplateID = WScript.Arguments(i)

                                    Next

                    else

                                    StrTemplateID = InputBox("No Provisioning Template ID provided as commandline argument. Goto http://YOURSERVER/MBSDKService/MsgSDK.asmx/GetProvisioningTemplates for a list of valid TemplateID's ")

                    end if

                     

                    if StrTemplateID = "" then

                                    StrServer = InputBox("No Provisioning Template ID provided as commandline argument.")

                                    WScript.quit

                    end if

                     

                    Set objNTInfo = CreateObject("WinNTSystemInfo")

                    GetComputerName = lcase(objNTInfo.ComputerName)

                    StrComputerName = objNTInfo.ComputerName

                     

                    SoapRequest = "<?xml version='1.0' encoding='utf-8'?>" &amp; VbCrLf &amp;_

                             "<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">" &amp; VbCrLf &amp;_

                             "  <soap12:Body>" &amp; VbCrLf &amp;_

                             "    <ScheduleProvisioningEx xmlns=""http://landesk.com/MBSDKService/MBSDK/"">" &amp; VbCrLf &amp;_

                             "      <TaskName>User_Started_Provisioning</TaskName>" &amp; VbCrLf &amp;_

                             "      <templateID>" &amp; StrTemplateID &amp; "</templateID>" &amp; VbCrLf &amp;_

                             "      <StartTime>17/12/2012 4:10:00 PM</StartTime>" &amp; VbCrLf &amp;_

                             "      <Targets>""Computer"".""Display Name"" = """ &amp; StrComputername &amp; """</Targets>" &amp; VbCrLf &amp;_

                             "      <reserved></reserved>" &amp; VbCrLf &amp;_

                             "      <deliveryMethod>_Provisioning Delivery</deliveryMethod>" &amp; VbCrLf &amp;_

                             "    </ScheduleProvisioningEx>" &amp; VbCrLf &amp;_

                             "  </soap12:Body>" &amp; VbCrLf &amp;_

                             "</soap12:Envelope>"

                     

                    'Msgbox Soaprequest

                     

                    intButton = WshShell.Popup ("Your Computer will be freshly installed. Are you sure to continue?", 0,"LANDesk Imaging", 1 + 64)

                     

                    select case intButton

                      case 1

                        wscript.sleep 1000

                      case 2

                        wscript.quit

                    End Select

                     

                    Set oHttp = CreateObject("Msxml2.XMLHTTP")

                    oHttp.open "POST", "HTTP://YOURSERVER/MBSDKService/MsgSDK.asmx", false, "DOMAIN\ACCOUNT","PASSWORD"

                    oHttp.setRequestHeader "Host" , "YOURSERVER"

                    oHttp.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8; action=""http://YOURSERVER/MBSDKService/MBSDK/ScheduleProvisioningEx"""

                    oHttp.setRequestHeader "Content-Length", Len(SoapRequest)

                    oHttp.send SoapRequest

                    strResult = oHttp.responseText

                     

                    'MsgBox strResult

                    • 7. Re: Script a Provisioning template(s) to run automatically?
                      Frank Wils ITSMMVPGroup

                      Hmmm... It seems like copy pasting the code made all &amp; to be &amp;amp... Before using the script, please replace all &amp;amp by &amp;

                       

                      Actually on vacation now, so please forgive me for not going through the whole script to change it ;)

                       

                      Frank

                      • 8. Re: Script a Provisioning template(s) to run automatically?
                        Apprentice

                        Many thanks Frank. We will adapt your script and test in our environment. Appreciate your efforts. Happy holiday!

                        • 9. Re: Script a Provisioning template(s) to run automatically?
                          MikeForg Apprentice

                          Hi Frank,

                           

                          I'm very new to Landesk. I'm trying to set up a menu that allows you to choose between various templates while in WinPE.

                           

                          I found your script very helpful, this showed me the way how to create tasks through MBSDK.

                           

                          Now I'm a bit stuck, as I get the task creation going if I start my script in Windows. But when I start the script in WinPE, the task is still created, but the computer name is not communicated, This means that the task has nothing in it and fails.

                           

                          Do you know a way to communicate the name so that I can lance a PROVISIONING task in WinPE.

                           

                          Thanks!

                          • 10. Re: Script a Provisioning template(s) to run automatically?
                            phoffmann SupportEmployee

                            <Somehow this thread got bumped, and I've seen it...>

                             

                            First up - here's something around the MBSDK that may help you - Getting Started with the MBSDK (Example Scripts Included)

                             

                            Next, in regard to "identifying the host name" - the way to do it would be to run a (BNF) query against the MBSDK - using the device's MAC-address (I give an example on how to run a query in the article). Essentially you want to be able to answer the question:

                             

                            "Here's my MAC. What hostname / computer_idn / device_ID has this MAC address?" ... so you can then use that to add the relevant device (I usually prefer device ID, personally) against your provisioning task if need be & start it.

                             

                            Does that help (assuming this is still a question / concern)?