Harkamals
Contributor
Contributor

EPI Agent - running provisioning scripts

VbScript.PreProvisioning.Name property calls the powershell script in scripts folder and which in turn calls the vbscript specified as property value.

can I instead provide a .ps1 file at a custom location as value for VbScript.PreProvisioning.Name ?

Thanks

0 Kudos
1 Reply
admin
Immortal
Immortal

The parent powershell script is located in the default external workflow configuration file.  One thing to keep in mind is that most powershell execution is done now with workflow designer and the invoke powershell activities.  So if this is a new setup, I'd recommend looking into that instead of messing around trying to get through the limiations of the old framework.

But for informational purposes...

The VbScript.PreProvisioning.Name custom property triggers the PreProvisioningVbOperation powershell to be run as seen below.

<plugin fullName="VMPSMasterWorkflowExternalWorkflows.ExecuteScriptWorkflow" priority="1">
    <MasterWFStateCriteria>BuildingMachine</MasterWFStateCriteria>
    <MasterWFTypeFullNameCriteria>*</MasterWFTypeFullNameCriteria>
    <ExecuteWhen>PreActivityExecution</ExecuteWhen>
    <AssemblyPath>[ExternalWorkflowsDirectory]\VMPSMasterWorkflowExternalWorkflows.dll</AssemblyPath>
    <AllPropertiesExist>
      <Property>VbScript.PreProvisioning.Name</Property>
    </AllPropertiesExist>
    <WorkflowArguments>
      <NameValue name="ScriptType">VBScripts</NameValue>
      <NameValue name="ServerPropertyKeyName"/>
      <NameValue name="ScriptName">PreProvisioningVbOperation</NameValue>
      <NameValue name="CreationFailureTargetStateName">Finalized</NameValue>
    </WorkflowArguments>
  </plugin>

You could create a new configuration for another workflow to run (I'd recommend putting it into a seperate file).  FYI, i don't think the script type really does anything...  Unfortunately, the EPI agent has a configured scripts directory and always appends the ".ps1" extension, so you'd have to configure another directory if you want an explicit path.  This is some of the limiations of this implementation.  What you could do is use a custom script inside of the default scripts directory and then have that script dot source or invoke the other location.  This might get tricky if you were executing remotely against a signed script.

<plugin fullName="VMPSMasterWorkflowExternalWorkflows.ExecuteScriptWorkflow" priority="1">
    <MasterWFStateCriteria>BuildingMachine</MasterWFStateCriteria>
    <MasterWFTypeFullNameCriteria>*</MasterWFTypeFullNameCriteria>
    <ExecuteWhen>PreActivityExecution</ExecuteWhen>
    <AssemblyPath>[ExternalWorkflowsDirectory]\VMPSMasterWorkflowExternalWorkflows.dll</AssemblyPath>
    <AllPropertiesExist>
      <Property>#NEW CUSTOM PROPERTY#</Property>
    </AllPropertiesExist>
    <WorkflowArguments>
      <NameValue name="ScriptType">PowerShell</NameValue>
      <NameValue name="ServerPropertyKeyName"/>
      <NameValue name="ScriptName">#YOUR SCRIPT NAME#</NameValue>
      <NameValue name="CreationFailureTargetStateName">Finalized</NameValue>
    </WorkflowArguments>
  </plugin>

0 Kudos