Quantcast
Channel: Ivanti User Community: Message List - OS Deployment and Provisioning
Viewing all articles
Browse latest Browse all 3345

Re: Script a Provisioning template(s) to run automatically?

$
0
0

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


Viewing all articles
Browse latest Browse all 3345


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>