Need to execute a PS workflow

Hi. I'm trying to run a PowerShell workflow (I'm using PS v4.0). Here's the code:
#Load the Active Directory PS module
Import-module activedirectory
#Collect information on trusted domains
$ADDomainTrust = Get-ADObject -Filter {ObjectClass -eq "trustedDomain"} -Properties * | Sort-Object cn
#Create workflow to execute trustsearch script in parallel
workflow Get-domains{
foreach -parallel ($trusteddomain in $ADDomainTrust){
$trust = $trusteddomain.name
powershell -command "C:\trustsearch.ps1 $trust"
The problem is the only thing the script does is load the active directory module, then it stops. I know the rest of the code works, because if I remove all of the workflow terminology it works fine. The objective of this script is to pull all of the trusted
domains into a collection then execute the "trustsearch.ps1" script against each one of the trusted domains AT THE SAME TIME. Running the script in series doesn't do me any good.
Can someone tell me what I'm doing wrong? Is this an activity that is even supported by .NET WWF?
Thanks.

Hi GA123,
To run a script (a .ps1 file) in a workflow, please enclose the call to the script in an
InlineScript activity.
And the script below is for your reference:
#Load the Active Directory PS module
Import-module activedirectory
#Create workflow to execute trustsearch script in parallel
workflow Get-domains{
#Collect information on trusted domains
$ADDomainTrust = Get-ADObject -Filter {ObjectClass -eq "trustedDomain"} -Properties * | Sort-Object cn | select -ExpandProperty Name
foreach -parallel ($trust in $ADDomainTrust){
InlineScript {C:\trustsearch.ps1 $using:trust}
If the script above can not work, please give the error infornmation if there is anything.
For more detailed information about workflow and parallel, please go through these articles:
Writing a Script Workflow
about_Foreach-Parallel
If you have any feedback on our support, please
click here.
Best Regards,
Anna Wang
TechNet Community Support

Similar Messages

  • Need to Execute a Dialog Task in Background

    Dear All,
    We have an requirement , where we need to execute a dialog workitem in the background. I need the techinicalities / features possible or not.
    We are having the workitem Id , I need to execute and get the options available with that first ( Assuming Workitem is User decision ). And in the next stage I will be passing the options like 0001 or 0002 ( approve / reject ) to another FM where the workitem gets completed and proceeds further.
    I need to perform the FM - SAP_WAPI_EXECUTE_WORKITEM  in the back ground in two steps.
    or Is there any FM which will update the user desicion with given options in background and executes a workitem , as if an SAP user is executing.
    regards,
    sabari prabhu.

    Prabhu,
    If you want to complete the workitem and if you process is still in workflow. Better way is to use Process control to complete the workitem & you can also use Condition step to validate the outcome or any option.
    If it is outside of the workflow which need to be completed, you can use "SAP_WAPI_EXECUTE_WORKITEM"
    If possible, can you elaborate your requirement.
    Thanks,
    Sudhir.

  • Help needed in executing a remote batch file

    I need to execute a batch file which is located on a remote machine through my machine. I have no idea to go about with. Please can someone help me out with can be used to execute the remote bat file. I am at present using Runtime.exec() to execute it on my machine.. But i cant use it to execute teh bat file on teh remote machine.Please help

    Below is an example server that would run on the remote host. You can connect to it using telnet from DOS prompt, it takes a Y/N to run your command in the cmd variable. I haven't included code for a client as it's really not needed for the example below.
    Change the cmd and port variables to what you need. You may need to setup firewall rules to allow your chosen port.
    Once it's running, you can test it by using "telnet localhost 1234" on your machine, localhost would obviously become the remote computer's hostname or IP.
    I am incredibly new to Java (using the forums to learn bits), so excuse any bad coding practises, I'm sure people will point them out.
    Keep in mind that this is totally insecure, so if you're using it on an untrusted network, you may want to look into encryption and providing some kind of password authentication, that, for the moment is out of my league.
    Screenshot here.
    import java.io.*;
    import java.net.*;
    class RemoteServer {
         public static int    port = 1234;           // Port to listen on
         public static String cmd  = "C:\\Test.bat"; // Command to run
         public static void main(String[] args)
              System.out.println("Waiting for connection...");
              try {
                   /* If you want the server to run forever, uncomment the while
                      loop */
                   // while (true)
                        startServer();
              } catch (IOException e) {
                   e.printStackTrace();
                   System.exit(1);
         /* Starts the server */
         private static void startServer() throws IOException
              ServerSocket server = null;
              Socket       client = null;
              String input;
              try {
                   server = new ServerSocket(port);
              } catch (IOException e) {
                   System.err.println("Unable to list on port " + port);
                   System.exit(1); // Can't listen, nothing else to do
              try {
                   client = server.accept();
                   System.out.println("Client connected... awaiting Y/N");
              } catch (IOException e) {
                   System.err.println("Unable to accept connection.");
                   System.exit(1);
              PrintWriter out = new PrintWriter(client.getOutputStream(), true);
              BufferedReader in = new BufferedReader(new InputStreamReader(
                                                     client.getInputStream()));
              out.println("You are connected, ready to launch command: <y/n>");
              while ((input = in.readLine()) != null)
                   if (input.equalsIgnoreCase("y"))
                        Runtime rt = Runtime.getRuntime();
                        rt.exec(cmd);
                        out.println("Command executed... disconnecting.");
                        System.out.println("Command executed... disconnecting client.");
                        break;
                   } else if (input.equalsIgnoreCase("n")) {
                        break;
                   } else {
                        out.println("Please enter Y/N.");
              out.close();
              in.close();
              client.close();
              server.close();
    }

  • Need to execute Long Insert (6000 characters)statement using dbms_sql.parse

    I built an insert statement which is more than 6000 (six thousand) characters stored into two varchar2 variables. I need to execute the statement using dbms_sql.parse.
    I tryed using dbms_sql.varchar2s variable and having no success.
    Any ideas or examples?
    Thanks
    JK

    6000 chars shouldn't be a problem.
    What do you mean with no success?Did you get any error?
    Any ideas or examples?See this thread
    Re: execute immediate with a string longer than 32767

  • Daily morning 8 o clock , we need to execute a select query

    Hi,
    daily morning 8 o clock , we need to execute a select query.
    How we can do this using dbms_scheduler? or any other ways?
    db version : 10g
    Thanks,
    Kumar.
    Message was edited by:
    user548258

    Use daily and byhour parameters as shown in below link.
    http://www.dba-oracle.com/t_dbms_scheduler_examples.htm

  • Need grant execute on dbms_rls for VPD

    Hi,
    I need grant execute on dbms_rls to setup "Virtual Private Database".
    How do I go about getting it?
    Thank you, Bill
    [email protected]

    Hi Scott and All,
    I got the DBA to grant execute to the workspace userid BHRS and run the 2 policies I have for the VPD as BHRS.
         begin
         dbms_rls.add_policy (
         object_schema => 'BHRS',
         object_name => 'MR_REQUEST',
         policy_name => 'USER_SU_POLICY',
         function_schema => 'BHRS',
         policy_function => 'GET_SU_USER_ID',
         statement_types => 'SELECT, UPDATE',
         update_check => TRUE
         end;
    But, when I went to select * from MR_REQUEST
    I got ORA-28112: failed to execute policy function
    So I reduced my function down to returning null
         create or replace function GET_SU_USER_ID
         return varchar2
         as
         l_retstr varchar2(2000);
         l_count integer:=0;
         begin
         l_retstr := null;
         return l_retstr;
         end;
    Researched a bit and found could look in the USER_DUMP file but the DBA here says the DB doesn't have one because we use the XDB ???
    How can I check the policy errors or debug this problem?
    Thanks Bill

  • Need to execute tcl script from a Java Program

    Hello,
    I need to execute a tcl script from a Java Program. But I do not know how to call the tcl Interpreter. Can anybody help me?

    Iam using the exec command as follows:
    Process proc =
    rt.exec("C:/SpirentConnect/engines/tcl/8.3.4/windows/s
    ctcl.exe C:/Hello.tcl");
    But Hello.tcl is not executed.And does that exact string work on the command line?
    And what is the return code from running it?

  • Need to execute a sub-VI continuously, while others are executed on demand.

    I'm running into a problem while trying to develop a set of controls for a scanning probe microscope. I have a PID control which governs the height of the probe above the sample (feedback input is through a PCI DAQ card), and which needs to run at all times. I also have a scan control which raster-scans the area of interest as defined in the input. Both of these programs work fine on their own. the problem I am encountering is: due to the nature of the position control equipment, these controls must be consolidated into a single VI (the "device handle" can only be called in one program at a time). The PID needs to execute constantly and in real time, while the scan needs to execute only on command. is there a relatively simple way to call a sub-VI such that it will run continuously at a high priority, while allowing another to be called on demand? Specifically, I need to avoid either sub-VI becoming caught in a "while" or "case" structure and refusing to allow the other to execute.

    I suppose I should have included a bit more information in my original post.
    I am running under windows XP, the PID updates once per millisecond via analog voltage reading, the instrument can queue commands but there's no current need to do so as the speed with which I need to issue commands is significantly below the USB polling rate.
    also, the problem with execution in parallel is that while the VI's are effectively independent, they both need to receive the same device ID from the controlling DLL. Unfortunately, the device ID command can't be called separately in each VI due to hardware restrictions, which is the reason I was looking for some sort of background execution option.
    I'm attaching the VI's themselves to make the situation a bit more clear as well.
    thanks for your input.
    Attachments:
    PID switchable1.vi ‏92 KB
    Raster Scan1.vi ‏174 KB

  • WHEN-TREE-NODE-SELECTED need 2 Execute-Query on Master-Detail data block

    I optimize tree using this link
    http://andreas.weiden.orcl.over-blog.de/article-29307730.html_+
    For huge amount of data (Accountings)
    All i need for now is
    WHEN-TREE-NODE-SELECTED need 2 Execute-Query on the data block
    DECLARE
    htree ITEM;
    node_value VARCHAR2(100);
    BEGIN
    IF :SYSTEM.TRIGGER_NODE_SELECTED = 'TRUE' THEN
    -- Find the tree itself.
    htree := FIND_ITEM ('BL_TREE.IT_TREE');
    node_value := FTREE.GET_TREE_NODE_PROPERTY( htree, :SYSTEM.TRIGGER_NODE ,  ftree.node_value  );
       GO_BLOCK ('GL_ACCOUNTS');
       set_block_property('GL_ACCOUNTS', DEFAULT_WHERE , 'ACCOUNT_ID ='|| node_value  );
    EXECUTE_QUERY;
    END IF;
    END;The above code is working fine 4 the detail block which is *'GL_ACCOUNTS'*
    when i substitute is Master block which is 'GL_ACCOUNTS_TYPES' it doesn't display all data
    Help is Appriciated pls.
    Regards,
    Abdetu...

    Hello
    In WHEN-TREE-NODE-SELECTED i modified the following code :_
    DECLARE
            htree ITEM;
           node_value VARCHAR2(100);
           parent_node FTREE.NODE;
    BEGIN
      IF :SYSTEM.TRIGGER_NODE_SELECTED = 'TRUE' THEN
      -- Find the tree itself.
      htree := FIND_ITEM ('BL_TREE.IT_TREE');
      -- Get the parent of the node clicked on. 
                  parent_node := FTREE.GET_TREE_NODE_PARENT ( htree, :SYSTEM.TRIGGER_NODE );
           GO_BLOCK('GL_TYPES');
                set_block_property('GL_TYPES', DEFAULT_WHERE , 'TYPE_ID ='|| parent_node  );
                  EXECUTE_QUERY;
      -- Get the detail of the parent node
          node_value := FTREE.GET_TREE_NODE_PROPERTY( htree, :SYSTEM.TRIGGER_NODE ,  ftree.node_value  );
               GO_BLOCK('GL_ACCOUNTS');
               set_block_property('GL_ACCOUNTS', DEFAULT_WHERE , 'ACCOUNT_ID ='|| node_value  );     
                   EXECUTE_QUERY;
          END IF;
    END;
    FRM-40350 : Query caused no records to be retrieved but i have records in the data base ...!
    Well, Do u think that's because in ur package i retrieve only the detail block ?
    Regards,
    Abdetu...

  • Need to execute some code once order created

    Hi,
    I have requirment like once the order in IW31(BO: BUS2007 ) is created i need to execute some custom code. please let me know the steps to do that.
    This process should complete without user interaction.
    Thanks,
    Sudheer. A

    Hi Sudheer,
    maybe you can have a look at user exit EXIT_SAPLCOIH_009.
    This is the exit where you can do some latest checks before saving the document in IW31.
    You can also write your own function module (e.g. Z_DO_THIS_AFTER_IW31) with the code to be executed and trigger this later. So that the code is not executed in the user exit, but a bit later after the real IW31 document is saved.
    Do that by using  CALL FUNCTION 'Z_DO_THIS_AFTER_IW31' IN UPDATE TASK.
    Here is the F1 help text on the 'IN UPDATE TAST' addition.
    Please let me know if this solved the problem..
    Grtz Marcel.
    CALL FUNCTION - IN UPDATE TASK
    Syntax
    CALL FUNCTION update_function IN UPDATE TASK
                                 [EXPORTING p1 = a1 p2 = a2 ...]
                                 [TABLES t1 = itab1 t2 = itab2 ...].
    Extras:
    1. ... EXPORTING p1 = a1 p2 = a2 ...
    2. ... TABLES t1 = itab1 t2 = itab2 ...
    Effect
    This statement registers the update function module specified in update_function. update_function must be a character-type field, which during execution of the statement contains the name of an update function module in uppercase letters.
    An update function module is a function module, for which in the Function Builder the property update module is marked. The registration of an update function module is an essential part of the update task.
    The function module is not executed immediately, but is scheduled for execution in a special work process (update work process). For this purpose, the name of the function module including the passed actual parameters is stored as a log record in the database table VBLOG. If the statement is executed during the update task, the addition IN UPDATE TASK is ignored.
    If the statement
    SET UPDATE TASK LOCAL is executed before registration of an update function module in the current SAP LUW, registration takes place in the ABAP memory rather than on the database, and for the current work process.
    The actual execution is triggered by the statement COMMIT WORK. The formal parameters of the function module receive the values of the actual parameters from table VBLOG. A function module that is registered several times will also be excuted several times with the respective parameter values.
    If a COMMIT WORK statement is not executed after registration of a function module during execution of the current program, the function module is not executed and is deleted from table VBLOG at the end of the program.

  • Before the answer file what do I need to execute

    After DNS,DHCP and ADLDS and before the answer file what do I need to execute besides:
    net user Administrator "password1" passwordreq:yes
    I am getting an error with NTDS.
    dcpromo /unattend:"E:\AnswerFiles\ForestAdd.txt"
    ForestAdd.txt
    [DCINSTALL]
    InstallDNS="Yes"
    NewDomain="Forest"
    NewDomainDNSName="mysite.com"
    DomainNetBiosName="MYSITE"
    ReplicaOrNewDomain="Domain"
    ForestLevel="4"
    DomainLevel="4"
    CreateDNSDelegation="No"
    DatabasePath="C:\Windows\NTDS"
    LogPath="C:\Windows\NTDS"
    SYSVOLPath="C:\Windows\SYSVOL"
    ConfirmGc="Yes"
    SafeModeAdminPassword=""
    ;ReplicateFromMedia = Yes
    ;SetForestVersion = Yes
    ;AutoConfigDNS = Yes
    ;SiteName = mydomain
    ;Run-time flags (optional)
    ;CriticalReplicationOnly="No"
    ;AllowAnonymousAccess = No
    ;DisableCancelForDnsInstall = No
    ;DNSOnNetwork = No
    ;IsLastDCInDomain = Yes
    ;RebootOnSuccess = Yes
    ;RemoveApplicationPartitions = Yes
    ;ReplicaOrMember = Replica
    ;RebootOnCompletion=Yes

    Hi,
    Please refer to the following articles:
    http://technet.microsoft.com/en-us/library/cc758390(v=ws.10).aspx
    Create an Answer File for Unattended Domain Controller Installation
    http://technet.microsoft.com/en-us/library/cc816873(v=ws.10).aspx
    How to use unattended mode to install and remove Active Directory Domain Services on Windows Server 2008-based domain controllers
    http://support.microsoft.com/kb/947034/en-au
    Meanwhile, please post the detail error message.
    Regards.
    Vivian Wang

  • Getting error : could not acquire the execute lock for workflow

    This kind of an issue normally occur when you are trying to run a workflow that is currently running or in a suspeneded state. we observe this issues when we are having multiple integration services. the workflow might be running in another integration service or in a debugger session. simple solution is check if it is running or in a suspended state by debugger or in another service. if yes stop it and restart the workflow ThanksHijesh

    Hi All, I made changes in source from oracle datatype to flat datatype then i changed again to oracle datatype.after that i tried to execute the task,i couldnt execute,below error shown. Error : could not acquire the execute lock for workflow.please check the Integartion log for more information. Note: other sessions also get changed. how do i execute this workflow with out any changes in session. please let me know. Thanks,Kate.

  • Authorization object to disable execute Button in Workflow Inbox

    I have a scenario where user can able to see workflow in Inbox but they are not suppose execute workflow(Disable Execute Icon), what is the  authorization object i need to use to disable this.
    Thanks,
    Nar

    Can you modify the method that is executed when you click the work item itself (is it a standard one)? If yes, just code a authorisation check there before the actual code.
    Or user authorisation trace to find out a possible authorisation checks when executing the work item. Hard to imagine that someone would know the object for this unlikely scenario. Or check that which transaction is launched from the code, and see if there is already some nice authorisation check (also with the trace).
    Regards,
    Karri

  • Re: Help needed in passing values from workflow to Approve Forms

    Dear Experts,
    how do I pass values from a workflow to a step (Form) - approve form?
    I am using a customized table structure as my data source (FORMCONTAINERELEMENT) but am stuck on how to access the data when i get to to the screen painter's flow logic... What am i missing? Can you give me a step by step example. the ones i see on the net are input fields that update the screen... nothing that shows value being passed from the outside.
    I need to pass an exisitng value in the workflow into the form for approval of the the assigned agent.
    Please help!!
    Thank you.

    Hello !
             Create a method just before the form step.This method should populate the values for the fields maintained in the form.
             Pass the values populated from this method to your customized table structure (data source).In other words, you have to pass all the values to the workflow container.
            To the step, pass this workflow container by binding.In the control tab of form step, you have to do the binding.
    Regards,
    S.Suresh

  • Help needed in executing pl/sql programs

    hi all
    iam new to PL/SQL programming
    i have installed oracle 9i
    iam trying to practice some sample pl/sql programs
    i have opened oracle 9i and typed these commands
    sql>ed sum
    then a notepad opens where i type my pl/sql program and save it and then return back to oracle 9i and type this
    sql>@ sum
    then my pl/sql program gets executed.......but iam not getting any output
    its comig as procedure implemented succesfully
    is it compulsory to open notepad to execute pl/sql progams or we can direclty type the programs in oracle 9i
    please help in this matter ASAP
    Regards
    Suresh

    Yes, you can type the program directly at the SQL prompt, but editing will be a bit difficult.
    You should use some good editor that allows you to edit properly and then run like you did.
    You need to do:
    SQL> set serveroutput onbefore running your program to see dbms_output messages.

Maybe you are looking for

  • OPI2 EDIFACT adapter - Module Exception Error

    Hi, We are on pI 7.0. Deployed open source custom EDI adapter (OPI2). Scenario: IDOC - - - xi -- - EDIFACT When I executed the scenario, I get the following error in comm channel monitoring. 2010-10-14 14:19:52 Success Message successfully received b

  • HP 1350 PSC Driver for Mac OS10.75

    I need a driver that will run the 1350 printer using my Mac .  

  • Connecting ipod nano to car radio

    i have 2 ipods ,one is one of the first ones made,wich i have played on my car radio ,just plug in the cable that charges ,and away,the second is a 3rd gen ipod nano,when i plug this into my car stereo jack it just says you must eject before disconne

  • Cannot close screen and listen itunes

    cannot close screen and listen to itunes connected to a receiver

  • I need advice on creating SubVIs

    Hi all, My code is getting bulky and I have created SubVIs to handle certain tasks. Here is what the code does: take in multiple data file paths from the user, and generate data summary tables, and lots of plots (table and plot formats controlled by