How to run execute immdiate with variables

Hi friends,
How to run execute immdiate with variables in v_stmt below?
I dont know how to declare the value of i here.
Set serveroutput on;
DECLARE
   i        VARCHAR (20);
   v_stmt   VARCHAR2 (100);
   CURSOR c
   IS
      SELECT sqlid FROM temp1;
BEGIN
   OPEN c;
   LOOP
      FETCH c INTO i;
      EXIT WHEN c%NOTFOUND;
      DBMS_OUTPUT.put_line (i);
      v_stmt := 'select * from table(dbms_xplan.display_cursor('&i',null))'
      execute immediate v_stmt;
   END LOOP;
   CLOSE c;
END;
/Regds,
Kunwar.

You first need to use a bind variable (named ':v' in SQL statement in my example):
set serveroutput on;
DECLARE
   i        VARCHAR (20);
   v_stmt   VARCHAR2 (100);
   CURSOR c
   IS
       -- modified for a quick test
      SELECT sql_id FROM v$sql where child_number > 2;
BEGIN
   OPEN c;
   LOOP
      FETCH c INTO i;
      EXIT WHEN c%NOTFOUND;
      DBMS_OUTPUT.put_line (i);
      v_stmt := 'select * from table(dbms_xplan.display_cursor(:v,null))';
      execute immediate v_stmt using i;
   END LOOP;
   CLOSE c;
END;
/However because your SELECT statement returns several rows you need to adapt your code to process all rows returned (as already suggested in first reply to your message).
Instead of using PL/SQL, I recommend to generate a SQL file using only SQL and then to run the generated SQL file.
For example:
spool edx.sql
set serveroutput on
declare
v_stmt varchar2(100);
v_q char(1):='''';
begin
dbms_output.put_line('spool edx.log');
for s in (select sql_id from v$sql where child_number >2)
loop
  dbms_output.put_line('select * from table(dbms_xplan.display_cursor(' || v_q || s.sql_id || v_q || ',null));');
end loop;
dbms_output.put_line('exit');
end;
spool ofThis generates a SQL file similar to :
spool edx.log
select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
select * from table(dbms_xplan.display_cursor('fsbqktj5vw6n9',null));
select * from table(dbms_xplan.display_cursor('6q42j0018w7t8',null));
select * from table(dbms_xplan.display_cursor('a5mmhrrnpwjsc',null));
select * from table(dbms_xplan.display_cursor('3c1kubcdjnppq',null));
select * from table(dbms_xplan.display_cursor('3c1kubcdjnppq',null));
select * from table(dbms_xplan.display_cursor('9gkq7rruycsjp',null));
select * from table(dbms_xplan.display_cursor('f0wj261bm8snd',null));
select * from table(dbms_xplan.display_cursor('ab3swhv5g138y',null));
select * from table(dbms_xplan.display_cursor('6vgvyh4xw9c5g',null));
select * from table(dbms_xplan.display_cursor('ak5crjygnpk60',null));
select * from table(dbms_xplan.display_cursor('9p6bq1v54k13j',null));
select * from table(dbms_xplan.display_cursor('19x1189chq3xd',null));
select * from table(dbms_xplan.display_cursor('7sx5p1ug5ag12',null));
select * from table(dbms_xplan.display_cursor('730vdzhng6m6g',null));
select * from table(dbms_xplan.display_cursor('730vdzhng6m6g',null));
select * from table(dbms_xplan.display_cursor('0v3dvmc22qnam',null));
select * from table(dbms_xplan.display_cursor('0v3dvmc22qnam',null));
select * from table(dbms_xplan.display_cursor('a1zv6wju3ftgv',null));
select * from table(dbms_xplan.display_cursor('7ng34ruy5awxq',null));
select * from table(dbms_xplan.display_cursor('7ng34ruy5awxq',null));
select * from table(dbms_xplan.display_cursor('b2gnxm5z6r51n',null));
select * from table(dbms_xplan.display_cursor('b2gnxm5z6r51n',null));
select * from table(dbms_xplan.display_cursor('g4gp07gt2z920',null));
select * from table(dbms_xplan.display_cursor('1gu8t96d0bdmu',null));
select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
select * from table(dbms_xplan.display_cursor('bn4b3vjw2mj3u',null));
select * from table(dbms_xplan.display_cursor('38243c4tqrkxm',null));
select * from table(dbms_xplan.display_cursor('2abjfnvy5rkyg',null));
select * from table(dbms_xplan.display_cursor('350f5yrnnmshs',null));
select * from table(dbms_xplan.display_cursor('350f5yrnnmshs',null));
select * from table(dbms_xplan.display_cursor('3s1yukp05bzg6',null));
select * from table(dbms_xplan.display_cursor('3s1yukp05bzg6',null));
select * from table(dbms_xplan.display_cursor('1tgukkrqj3zhw',null));
exit
PL/SQL procedure successfully completed.Edited by: P. Forstmann on 20 mars 2013 19:06
Edited by: P. Forstmann on 20 mars 2013 19:33

Similar Messages

  • How to run JavaFX Jar with JRE 7 on MAC OS Lion 10.7.5 ?

    I had java 1.6 installed on my MAC OSX Lion 10.7.5. When I am trying to run that JavaFX application jar
    java -jar application.jar
    It always shows a dialog "The application require a newer version of Java Run-time" with download link. Even I have downloaded and successfully installed it on my MAC machine but it still shows me the same window.
    It installed jre-7u10-macosx-x64.dmg but java -version is always point to 1.6.
    Then I searched for Java Preferences to point the current JRE 1.7 but I could find Java Preferences at Applications -> Utilities -> Java -> Java Preferences.
    I found an Java Icon on System Preference. When I am trying to open that widow it's showing me error -- the java control panel opens in a separate window and nothing happens when we click on Re-open the Java Control Panel.
    http://avats.s3.amazonaws.com/JavaRunningError.txt
    I would like to know -- how to run JavaFX jar with JRE7 on MAC OS Loin 10.7.5? Is their any other way to run the JavaFX application JAR with JRE7?

    To find a copy of LP7 you would need to look for a copy on eBay.. However, the protection method used with LP7 no longer functions so you cannot register it and therefore you cannot use it. unless you have already registered LP7 yourself in the past using the security key dongle provided
    Any version of LP7 from a torrent would be an illegal (and most likely non working) version due to the protection that was used at that time... and so posting about it here, was not be wise.
    So.. thats why my previous answer was so brief... Simply put, you cannot use LP7 unless you already have a validated and registered security dongle... even if you found a copy of LP7 somewhere
    The only practical solution is to find some kind soul who already has a working version of LP7 installed, that you can send the projects to... for them to do the conversion for you.
    I would, but I no longer have LP7 installed here on any of my testbed Macs...

  • How to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5 ?

    I have created a bundled JavaFX application jar with ANT on Windows 8 O.S. , 64 bit machine. I have JavaFx2.0 and Java 1.7.0_09 installed on my Window O.S.
    <target name="CreatingJars" depends="Compiling" description="generate the distribution" >
                        <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"     
                                 uri="javafx:com.sun.javafx.tools.ant" classpath="${env.JAVA_HOME}/lib/ant-javafx.jar"/>
                              <mkdir dir="${WorkingFolder}/temp/libs"/>
                             <copy todir="${WorkingFolder}/temp/libs">
                             <fileset file="${WorkingFolder}/CustomJars/ProjectLib.jar">
                             </fileset>
                             </copy>
                             <copy todir="${WorkingFolder}/temp/libs">
                             <fileset dir="${WorkingFolder}/libs">
                             </fileset>
                        </copy>
                        <fx:jar destfile="${WorkingFolder}/${app.name}.jar">
                        <fx:application mainClass="${main.class}"/>
                        <fx:resources>
                             <fx:fileset dir="${WorkingFolder}/temp/"/>
                        </fx:resources>
                        <fileset dir="${WorkingFolder}/build"/>
                        <fileset dir="${WorkingFolder}/resources"/>
                        </fx:jar>
         </target> When I am trying to run that JavaFX application jar on MAC OS Lion 10.7.5 using
    java -jar application.jar
    It always shows a dialog "The application require a newer version of Java Run-time" with download link. Even I have downloaded and successfully installed it on my MAC machine but it still shows me the same window.
    java -version is always point to 1.6.
    Then I searched for Java Preferences to point the current JRE 1.7 but I could find Java Preferences at Applications -> Utilities -> Java -> Java Preferences.
    I would like to know -- how to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5? Is their any other way to run the JavaFX application JAR with JRE7?

    Do I need to download the whole JAVA 1.7 on MAC to run the JAR? No
    Can not I run the Jar file with Jre7?Yes, you can.
    This may be because I have downloaded the JRE 1.7Yep, that's correct, the java_home command only works for jdk's - sorry for the confusion.
    For jre7+ versions, only a single Oracle jre version is allowed to be installed on the machine at a time - making a tool like java_home redundant for jre checking.
    Weirdly, jre7u10 does not supplant the Apple Java on the command line path by default. If you just type java -v, then the Apple java version will displayed if you have an old Java 6 from Apple and a new Oracle jre7+.
    The Oracle jre is always located under (also somewhat strangely):
    /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/javaTo test jar launching, I used the willow JavaFX browser pre-release jar available here:
    http://code.google.com/p/willow-browser/downloads/detail?name=Willow-0.1-prerelease.jar
    Then I launched the jar from the command line using:
    /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -jar Willow-0.1-prerelease.jar The JavaFX jar ran fine on jre7 with the above machine.
    The test machine was running Mac OS X 8 with Oracle jre7u10 installed as well as the Apple Java 6 runtime, but no Oracle jdk7+ installed.

  • How to insert a table with variable rows in smart form

    Hi all,
    How to insert a table with variable rows in smart form?
    Any help would be appreciated.
    Regards,
    Mahesh.

    Hi,
    Right click the mouse->create->table
    If you want 5 columns, you need to declare 5 cells in one line type of the table
    Click on Table -> Details, then do the following
    Line Type 1 2 3 4 5
    L1 2mm 3mm etc
    Here specify the width of the columns as many as you want..
    then in the header/main area of the table, click create Table Line, Rowtype is L1, automatically 5 cells will come,In each cell create a text element, display the variable to be printed there.

  • How to run hardware diagnostic with the help of terminal?

    how to run hardware diagnostic with the help of terminal? any cmds

    Macs newer than 10.7's release just need to boot with the 'D' key.  
    Otherwise you need to find the original installer disk of the Mac, or call AppleCare for it to be able to run the hardware diagnostic.

  • How to run .exe files with Virtual PC for Mac

    Hey Guys, I'm new around here and with mac technology as well. Anyway, I have an iMac OS X 10.5.1 Leopard and I've recently purchased the Virtual PC for Mac 7.0.2 software. So I'd like to know how to use this program properly, because I need to run some executable files in my computer. It is confusing for me because I don't know how to get started, and I only get to the part when it says "OS not found, Install an OS on this hard drive".
    Honestly I've no idea of what an OS is or where do I get that. So I'd really appreciate if one of you guys could tell me, step by step, what to do to use Virtual PC properly, and finally learn how to run .exe files on mac.
    Thanks in advance!
    Have a nice day!

    Always nice to see new faces
    Honestly I've no idea of what an OS is or where do I get that.
    This brings up the second part of your problem. The first part is setting up either a proper Virtual Machine program like Parallels or VMfusion, or setting up a Boot Camp partition on your drive.
    http://www.parallels.com/
    http://www.vmware.com/products/fusion/
    OS stands for Operating System. You are running Leopard 10.5.7 as an operating system on your Mac (MacOS X).
    The second part of your problem - You will need a copy of Windows XP or Vista if you want to run Windows on your Mac.
    There is at least one other solution for running Windows programs on a Mac. It's called "CrossOver" by a company named 'Codeweavers'. It's based on a project for "Wine" to be able to run PC programs on a Mac or Linux, without having to buy or install Windows. It works with a narrow subset of Windows programs so you would want to make sure the program you want to run is compatible with CrossOver before you buy it.
    http://www.codeweavers.com/products/cxmac/
    In addition to all the above information, you need to upgrade your Mac to the latest 10.5.7 from 10.5.1. "Software Update" is located under the black Apple icon in the Menu Bar at the top left corner of your monitor. After you are updated you will want to update your Profile here so that it shows the proper OS version.
    With your level of experience with MacOS X and the Windows OS's you should probably get some help from a local Apple store. They have an appointment system and do offer many types of help and training, and they can offer assistance with choosing the proper programs for you to purchase for your machine.
    You are also welcome to continue to ask questions here, of course. You will want to ask your questions with different issues that come up in different threads so that the answers stay focused on the title of the thread.
    Message was edited by: dechamp to try to be more accurate with a fairly complicated issue...

  • How to run executable after installation?

    Hi everyone,
    I created an installer from one labview program with the application builder
    of Labview7.1 for my customer, and this installer will be burned
    on a CD. There are several configuration files which should be always
    modified, so I want to give the customer a possibility that he can
    change them by himself without creation of a new installer , I think the
    "run executable after installation" is the way to do it, but I don't know
    how to implement such an executable command to copy some files from CD to
    the destination directory which the program should be installed, could
    anyone give me some tips? Thans a lot!
    Le

    When you setup your build file, add the files using SourceFile Tab>>add support files, then click on custom destination, here you can add support files during installation. Hope this is what you are looking for.
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • How to Run std program with a specific variant for specific user?

    Hi guys
    We have a std program which will be run by different users in the company. Now the requirement is to make sure that each user runs the report with a specific varaint. Can we control this if yes how?
    one options we thought about was to create a transaction in SE93 and define the program to run with a predefined varaint and assign the new custom tcode to the user profile. But we have many different users and we will end up with creating many transactions which we would like to avoid. Is there any other option to control the std program such that each user can run the program only with a pre-defined varaint and the one which only the user is suppoed to run. thanks in advance.

    We have a std program which will be run by different users in the company. Now the requirement is to make sure that each user runs the report with a specific varaint. Can we control this if yes how
    you can do this..
    You can create a Custom table
    userid     keyfield
    program  keyfield
    variant    keyfield
    programdesc
    Make the table Maintaintable(usnig table maintenance )
    Now create another Program
    It takes input of the Program name( using selection screen)
    LOGIC
    in side that place a logic ,
    Based on the user name  and program name Get the variant name from above table
    Now Submit the program with the variant you have selected above.
    Use Variant Addition when you use SUBMIT
    So now program executed based on user variant.
    Now you create a Transaction for this program.
    When use Runs the Transaction , user needs to input the Program name which he wants to execute.
    and Output will be shown based on the variants
    Regards
    Vijay Babu Dudla

  • Powershell: how to run vbs script with switches.

    Background: To remove a specific service, I usually log into a server, go to path c$\Program files\HP... find a specific vbs, and run it using CMD.exe.
    Now, I'm new to powershell, so I'm looking into automating this job. When I use CMD, I run cscript path\serviceinstall.vbs
    -r.
    How do I add cscript switches to powershell?
    IF
    ((test-path -path "servername\C$\Program Files\...") -eq "true")
    invoke-command -scriptblock ""servername\C$\Program Files\...\serviceinstall.vbs -r?

    1. You cannot run VBS as a scriptblock.
    2.  If youactually were to have read the full help ypu would have seen how to use the command.
    3.  Given you initial questin and the vague answers you gave there is nothing any could do to help you.
    If you do not give accurate information you will not likely get answers that are helpful.
    I recommend starting at the beginning and learning PowerShell basics.  If you had done that you would know that a script block is not a quoted string with vbscript in it or the path to a file.
    When working with any technology it is important to read the instructions carefully.  It is also useful to knowhow to do basic research on the technology you are trying to learn.
    There are 15 examples in PowerShell V2 for Invoke-Command.  Here they are as captured directly from PowerShell V2. (The is no update-help on V2. All help is built in.)
    -------------------------- EXAMPLE 1 --------------------------
    C:\PS>invoke-command -filepath c:\scripts\test.ps1 -computerName Server01
    Disks: C:, D:, E:
    Status: Warning, Normal, Normal
    Description
    This command runs the Test.ps1 script on the Server01 computer.
    The command uses the FilePath parameter to specify a script that is located on the local computer. The script runs
    on the remote computer and the results are returned to the local computer.
    -------------------------- EXAMPLE 2 --------------------------
    C:\PS>invoke-command -computername server01 -credential domain01\user01 -scriptblock {get-culture}
    Description
    This command runs a Get-Culture command on the Server01 remote computer.
    It uses the ComputerName parameter to specify the computer name and the Credential parameter to run the command in
    the security context of "Domain01\User01," a user with permission to run commands. It uses the ScriptBlock paramete
    r to specify the command to be run on the remote computer.
    In response, Windows PowerShell displays a dialog box that requests the password and an authentication method for t
    he User01 account. It then runs the command on the Server01 computer and returns the result.
    -------------------------- EXAMPLE 3 --------------------------
    C:\PS>$s = new-pssession -computername server02 -credential domain01\user01
    C:\PS> invoke-command -session $s -scriptblock {get-culture}
    Description
    This example runs the same "Get-Culture" command in a session (a persistent connection) on the Server02 remote comp
    uter. Typically, you create a session only when you are running a series of commands on the remote computer.
    The first command uses the New-PSSession cmdlet to create a session on the Server02 remote computer. Then, it saves
    the session in the $s variable.
    The second command uses the Invoke-Command cmdlet to run the Get-Culture command on Server02. It uses the Session p
    arameter to specify the session saved in the $s variable.
    In response, Windows PowerShell runs the command in the session on the Server02 computer.
    -------------------------- EXAMPLE 4 --------------------------
    C:\PS>invoke-command -computername Server02 -scriptblock {$p = get-process powershell}
    C:\PS> invoke-command -computername Server02 -scriptblock {$p.virtualmemorysize}
    C:\PS>
    C:\PS> $s = new-pssession -computername Server02
    C:\PS> invoke-command -session $s -scriptblock {$p = get-process powershell}
    C:\PS> invoke-command -session $s -scriptblock {$p.virtualmemorysize}
    17930240
    Description
    This example compares the effects of using ComputerName and Session parameters of Invoke-Command. It shows how to u
    se a session to run a series of commands that share the same data.
    The first two commands use the ComputerName parameter of Invoke-Command to run commands on the Server02 remote comp
    uter. The first command uses the Get-Process command to get the PowerShell process on the remote computer and to sa
    ve it in the $p variable. The second command gets the value of the VirtualMemorySize property of the PowerShell pro
    cess.
    The first command succeeds. But, the second command fails because when you use the ComputerName parameter, Windows
    PowerShell creates a connection just to run the command. Then, it closes the connection when the command is complet
    e. The $p variable was created in one connection, but it does not exist in the connection created for the second co
    mmand.
    The problem is solved by creating a session (a persistent connection) on the remote computer and by running both of
    the related commands in the same session.
    The third command uses the New-PSSession cmdlet to create a session on the Server02 computer. Then it saves the ses
    sion in the $s variable. The fourth and fifth commands repeat the series of commands used in the first set, but in
    this case, the Invoke-Command command uses the Session parameter to run both of the commands in the same session.
    In this case, because both commands run in the same session, the commands succeed, and the $p value remains active
    in the $s session for later use.
    -------------------------- EXAMPLE 5 --------------------------
    C:\PS>$command = { get-eventlog -log "windows powershell" | where {$_.message -like "*certificate*"} }
    C:\PS> invoke-command -computername S1, S2 -scriptblock $command
    Description
    This example shows how to enter a command that is saved in a local variable.
    When the entire command is saved in a local variable, you can specify the variable as the value of the ScriptBlock
    parameter. You do not have to use the "param" keyword or the ArgumentList variable to submit the value of the local
    variable.
    The first command saves a Get-Eventlog command in the $command variable. The command is formatted as a script block
    The second command uses the Invoke-Command cmdlet to run the command in $command on the S1 and S2 remote computers.
    -------------------------- EXAMPLE 6 --------------------------
    C:\PS>invoke-command -computername server01, server02, TST-0143, localhost -configurationname MySession.PowerShell
    -scriptblock {get-eventlog "windows powershell"}
    Description
    This example demonstrates how to use the Invoke-Command cmdlet to run a single command on multiple computers.
    The command uses the ComputerName parameter to specify the computers. The computer names are presented in a comma-s
    eparated list. The list of computers includes the "localhost" value, which represents the local computer.
    The command uses the ConfigurationName parameter to specify an alternate session configuration for Windows PowerShe
    ll and the ScriptBlock parameter to specify the command.
    In this example, the command in the script block gets the events in the Windows PowerShell event log on each remote
    computer.
    -------------------------- EXAMPLE 7 --------------------------
    C:\PS>$version = invoke-command -computername (get-content machines.txt) -scriptblock {(get-host).version}
    Description
    This command gets the version of the Windows PowerShell host running on 200 remote computers.
    Because only one command is run, it is not necessary to create persistent connections (sessions) to each of the com
    puters. Instead, the command uses the ComputerName parameter to indicate the computers.
    The command uses the Invoke-Command cmdlet to run a Get-Host command. It uses dot notation to get the Version prope
    rty of the Windows PowerShell host.
    To specify the computers, it uses the Get-Content cmdlet to get the contents of the Machine.txt file, a file of com
    puter names.
    These commands run synchronously (one at a time). When the commands complete, the output of the commands from all o
    f the computers is saved in the $version variable. The output includes the name of the computer from which the data
    originated.
    -------------------------- EXAMPLE 8 --------------------------
    C:\PS>$s = new-pssession -computername Server01, Server02
    C:\PS> invoke-command -session $s -scriptblock {get-eventlog system} -AsJob
    Id Name State HasMoreData Location Command
    1 Job1 Running True Server01,Server02 get-eventlog system
    C:\PS> $j = Get-Job
    C:\PS> $j | format-list -property *
    HasMoreData : True
    StatusMessage :
    Location : Server01,Server02
    Command : get-eventlog system
    JobStateInfo : Running
    Finished : System.Threading.ManualResetEvent
    InstanceId : e124bb59-8cb2-498b-a0d2-2e07d4e030ca
    Id : 1
    Name : Job1
    ChildJobs : {Job2, Job3}
    Output : {}
    Error : {}
    Progress : {}
    Verbose : {}
    Debug : {}
    Warning : {}
    StateChanged :
    C:\PS> $results = $j | Receive-Job
    Description
    These commands run a background job on two remote computers. Because the Invoke-Command command uses the AsJob para
    meter, the commands run on the remote computers, but the job actually resides on the local computer and the results
    are transmitted to the local computer.
    The first command uses the New-PSSession cmdlet to create sessions on the Server01 and Server02 remote computers.
    The second command uses the Invoke-Command cmdlet to run a background job in each of the sessions. The command uses
    the AsJob parameter to run the command as a background job. This command returns a job object that contains two ch
    ild job objects, one for each of the jobs run on the two remote computers.
    The third command uses a Get-Job command to save the job object in the $j variable.
    The fourth command uses a pipeline operator (|) to send the value of the $j variable to the Format-List cmdlet, whi
    ch displays all properties of the job object in a list.
    The fifth command gets the results of the jobs. It pipes the job object in $j to the Receive-Job cmdlet and stores
    the results in the $results variable.
    -------------------------- EXAMPLE 9 --------------------------
    C:\PS>$MWFO-LOg = Microsoft-Windows-Forwarding/Operational
    C:\PS> invoke-command -computername server01 -scriptblock {param($log, $num) get-eventlog -logname $log -newest $nu
    m} -ArgumentList $MWFO-log, 10
    Description
    This example shows how to include the values of local variables in a command run on a remote computer.
    The first command saves the name of the Microsoft-Windows-Forwarding/Operational event log in the $MWFO-Log variabl
    e.
    The second command uses the Invoke-Command cmdlet to run a Get-EventLog command on the Server01 remote computer tha
    t gets the 10 newest events from the Microsoft-Windows-Forwarding/Operational event log on Server01.
    This command uses the "param" keyword to create two variables, $log and $num, that are used as placeholders in the
    Get-EventLog command. These placeholders have arbitrary names that do not need to match the names of the local vari
    ables that supply their values.
    The values of the ArgumentList parameter demonstrate the two different ways to specify values in the argument list.
    The value of the $log placeholder is the $MFWO-Log variable, which is defined in the first command. The value of t
    he $num variable is 10.
    Before the command is sent to the remote computer, the variables are replaced with the specified values.
    -------------------------- EXAMPLE 10 --------------------------
    C:\PS>invoke-command -computername S1, S2 -scriptblock {get-process powershell}
    PSComputerName Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
    S1 575 15 45100 40988 200 4.68 1392 powershell
    S2 777 14 35100 30988 150 3.68 67 powershell
    C:\PS> invoke-command -computername S1, S2 -scriptblock {get-process powershell} -HideComputerName
    Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
    575 15 45100 40988 200 4.68 1392 powershell
    777 14 35100 30988 150 3.68 67 powershell
    Description
    This example shows the effect of using the HideComputerName parameter of Invoke-Command.
    The first two commands use the Invoke-Command cmdlet to run a Get-Process command for the PowerShell process. The o
    utput of the first command includes the PsComputerName property, which contains the name of the computer on which t
    he command ran. The output of the second command, which uses the HideComputerName parameter, does not include the P
    sComputerName column.
    Using the HideComputerName parameter does not change the object. You can still use the Format cmdlets to display th
    e PsComputerName property of any of the affected objects.
    -------------------------- EXAMPLE 11 --------------------------
    C:\PS>invoke-command -comp (get-content servers.txt) -filepath c:\scripts\sample.ps1 -argumentlist Process, Service
    Description
    This example uses the Invoke-Command cmdlet to run the Sample.ps1 script on all of the computers listed in the Serv
    ers.txt file. The command uses the FilePath parameter to specify the script file. This command allows you to run th
    e script on the remote computers, even if the script file is not accessible to the remote computers.
    When you submit the command, the content of the Sample.ps1 file is copied into a script block and the script block
    is run on each of the remote computers. This procedure is equivalent to using the ScriptBlock parameter to submit t
    he contents of the script.
    -------------------------- EXAMPLE 12 --------------------------
    C:\PS>$LiveCred = Get-Credential
    C:\PS> Invoke-Command -ConfigurationName Microsoft.Exchange `
    -ConnectionUri https://ps.exchangelabs.com/powershell `
    -Credential $LiveCred -Authentication Basic `
    -scriptblock {Invoke-Command {Set-Mailbox dan -DisplayName "Dan Park"}
    Description
    This example shows how to run a command on a remote computer that is identified by a URI (Internet address). This p
    articular example runs a Set-Mailbox command on a remote Exchange server. The backtick (`) in the command is the Wi
    ndows PowerShell continuation character.
    The first command uses the Get-Credential cmdlet to store Windows Live ID credentials in the $LiveCred variab the c
    redentials dialog box appears, enter Windows Live ID credentials.
    The second command uses the Invoke-Command cmdlet to run a Set-Mailbox command. The command uses the ConfigurationN
    ame parameter to specify that the command should run in a session that uses the Microsoft.Exchange session configur
    ation. The ConnectionURI parameter specifies the URL of the Exchange server endpoint.
    The credential parameter specifies tle. Whenhe Windows Live credentials stored in the $LiveCred variable. The Authe
    nticationMechanism parameter specifies the use of basic authentication. The ScriptBlock parameter specifies a scrip
    t block that contains the command.
    -------------------------- EXAMPLE 13 --------------------------
    C:\PS>$max = New-PSSessionOption -MaximumRedirection 1
    C:\PS> Invoke-Command -ConnectionUri https://ps.exchangelabs.com/powershell `
    -scriptblock {Invoke-Command {Get-Mailbox dan} `
    -AllowRedirection -SessionOption $max
    Description
    This command shows how to use the AllowRedirection and SessionOption parameters to manage URI redirection in a remo
    te command.
    The first command uses the New-PSSessionOption cmdlet to create a PSSessionOpption object that it saves in the $max
    variable. The command uses the MaximumRedirection parameter to set the MaximumConnectionRedirectionCount property
    of the PSSessionOption object to 1.
    The second command uses the Invoke-Command cmdlet to run a Get-Mailbox command on a remote server running Microsoft
    Exchange Server. The command uses the AllowRedirection parameter to provide explicit permission to redirect the co
    nnection to an alternate endpoint. It also uses the SessionOption parameter to specify the session object in the $m
    ax variable.
    As a result, if the remote computer specified by the ConnectionURI parameter returns a redirection message, Windows
    PowerShell will redirect the connection, but if the new destination returns another redirection message, the redir
    ection count value of 1 is exceeded, and Invoke-Command returns a non-terminating error.
    -------------------------- EXAMPLE 14 --------------------------
    C:\PS>$so = New-PSSessionOption -SkipCACheck
    PS C:\> invoke-command $s { get-hotfix } -SessionOption $so -credential server01\user01
    Description
    This example shows how to create and use a SessionOption parameter.
    The first command uses the New-PSSessionOption cmdlet to create a session option. It saves the resulting SessionOpt
    ion object in the $so parameter.
    The second command uses the Invoke-Command cmdlet to run a Get-Hotfix command remotely. The value of the SessionOpt
    ion parameter is the SessionOption object in the $so variable.
    -------------------------- EXAMPLE 15 --------------------------
    C:\PS>enable-wsmanCredSSP -delegate server02
    C:\PS> connect-wsman Server02
    C:\PS> set-item wsman:\server02*\service\auth\credSSP -value $true
    C:\PS> $s = new-pssession server02
    C:\PS> invoke-command -session $s -script {get-item \\Net03\Scripts\LogFiles.ps1} -authentication credssp -credenti
    al domain01\admin01
    Description
    This example shows how to access a network share from within a remote session.
    The command requires that CredSSP delegation be enabled in the client settings on the local computer and in the ser
    vice settings on the remote computer. To run the commands in this example, you must be a member of the Administrato
    rs group on the local computer and the remote computer.
    The first command uses the Enable-WSManCredSSP cmdlet to enable CredSSP delegation from the Server01 local computer
    to the Server02 remote computer. This configures the CredSSP client setting on the local computer.
    The second command uses the Connect-WSman cmdlet to connect to the Server02 computer. This action adds a node for t
    he Server02 computer to the WSMan: drive on the local computer, allowing you to view and change the WS-Management s
    ettings on the Server02 computer.
    The third command uses the Set-Item cmdlet to change the value of the CredSSP item in the Service node of the Serve
    r02 computer to True. This action enables CredSSP in the service settings on the remote computer.
    The fourth command uses the New-PSSession cmdlet to create a PSSession on the Server02 computer. It saves the PSSes
    sion in the $s variable.
    The fifth command uses the Invoke-Command cmdlet to run a Get-Item command in the session in $s that gets a script
    from the Net03\Scripts network share. The command uses the Credential parameter and it uses the Authentication para
    meter with a value of CredSSP.
    I suggest spending som etime learning the basics.  It will save you a lot of frustration in the future.
    ¯\_(ツ)_/¯

  • How to run others applications with abap commands

    Is there a mothed that can use it to run an application with abap statement?
    for example: how to open a text file in program with abap command?
    thank you very much.

    CALL FUNCTION '<b>WS_EXECUTE'</b>
    EXPORTING
      DOCUMENT                 = ' '
      CD                       = ' '
       <b>COMMANDLINE</b>              = ''
      INFORM                   = ' '
      <b> PROGRAM                 </b> = 'NOTEPAD'
      STAT                     = ' '
      WINID                    = ' '
      OSMAC_SCRIPT             = ' '
      OSMAC_CREATOR            = ' '
      WIN16_EXT                = ' '
      EXEC_RC                  = ' '
    IMPORTING
      RBUFF                    =
    EXCEPTIONS
      FRONTEND_ERROR           = 1
      NO_BATCH                 = 2
      PROG_NOT_FOUND           = 3
      ILLEGAL_OPTION           = 4
      GUI_REFUSE_EXECUTE       = 5
      OTHERS                   = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Here...
    In the <b>CommandLine</b> you can give the path where the file is located like for Example
    C:\Test\Hello.txt.
    In the <b>Program</b> you need to give the application that you want to open that file.
    if helpful reward points...
    Regards,
    Vivekananda Varma Dandu

  • How to use wild card with variable in powershell

    HI
    i am trying to use wild card with variable but getting an error message, "You cannot call a method on a null-valued expression."
    $src = 'C:\Temp'
    $TabletzipPath = $src + "tab*.zip"
    i would like to copy the tablet zip file which is placed in in $src to be copied in $TabletzipPath.
    i am using tab* because this file name changes continuously. so if i give a fix name for example tablet1.zip than it works fine.

    Not sure if the wildcard will work without seeing how you're using the variable.
    That said, I can say that it looks like you're missing the backslash between the $src path and the wildcard filename. As-is the above code assigns a value to $TabletzipPath of "C:\temptab*.zip" instead of what you are likely expecting ("C:\temp\tab*.zip")
    Jason Warren
    @jaspnwarren
    jasonwarren.ca
    habaneroconsulting.com/Insights

  • How to create a array with variables dimensions?

    I try to create a array like that:
    Object[][] data;
    data = new Object[] [];
    But that's doesn't work!
    Apparently I must specify the dimension of my array
    So I have done like that :
    Object[][] data;
    data = new Object[3] [3];
    And that work!
    But the problem is when I need to add extra elements to my array.
    If I write :
    data[4][1] = "123";
    I have the error message :
    java.lang.ArrayIndexOutOfBoundsException
    So, how can I defined a array with variables dimensions OR how can I add a dimension to a array?

    if you have:
    Object[][] data;
    data = new Object[3] [3];you end yo getting ArrayIndexOutOfBoundException if you try to point to some other Indexes. You can increase the size by doing new:
    Object[][] data;
    data = new Object[4] [3];and then copy the old Arrays to this one... this is heavy.
    Other thing to consider then is using some other datastructure, such as Vector, which grows along you add elements to it.
    P_trg

  • How to run the program with variant automatically

    Hi experts,
    I want to know how can I run the program with a variant automatically without defining any transactions or jobs. I want my program to run with a variant automatically, when I press F8.

    Try doing this way...
    First Create a Sel Screen varient, 'ZTEST123' in this case
    Report ZTEST.
    parameters:
      w_kunnr type kna1-kunnr,
      w_flag type c no-display.
    start-of-selection.
    if w_flag eq ' '.
      submit ZTEST USING SELECTION-SET 'ZTEST123' with w_flag eq 'X'.
    endif.
    end-of-selection.
      write:  w_kunnr.
    Thanks.

  • How to run Struts program with the help of tomcat

    Hello Everybody
    This is Adesh.I am a newcomer of java and facing a problem with struts, so if any one know how to set the path of struts and how to run struts program, so plz inform me.
    THX in Advance.............................................

    struts-config.xml
    <struts-config>
    <action-mappings>
         <action path  = "/welcome"
                    type  = "Welcome"
                    scope="session">
                <forward name="success" path=".welcome"/>
                <forward name="failure" path=".base.error"/>
         </action>
    </action-mappings>
        <plug-in className="org.apache.struts.tiles.TilesPlugin">
            <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>
            <set-property property="definitions-debug" value="1"/>
            <set-property property="definitions-parser-details" value="0"/>
            <set-property property="definitions-parser-validate" value="true"/>
        </plug-in>
    </struts-config>tiles-defs.xml
    <tiles-definitions>
         <definition name = ".base" path = "/include/template.jsp">
              <put name = "title" value = "${title}"/>
              <put name = "header" value = "/include/top.jsp"/>
              <put name = "body" value = "${body}"/>
              <put name = "footer" value = "/include/footer.jsp"/>
         </definition>
    </tiles-definitions>web.xml
    <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
            <init-param>
                <param-name>config</param-name>
                <param-value>/WEB-INF/struts-config.xml</param-value>
            </init-param>
    <init-param>
                <param-name>definitions-config</param-name>
                <param-value>/WEB-INF/tiles-defs.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
    <servlet>
            <servlet-name>init</servlet-name>
            <servlet-class>Init</servlet-class>
            <load-on-startup>2</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
      <jsp-config>
        <taglib>
            <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/wall.tld</taglib-uri>
            <taglib-location>/WEB-INF/wall.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/c.tld</taglib-uri>
            <taglib-location>/WEB-INF/c.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/fn.tld</taglib-uri>
            <taglib-location>/WEB-INF/fn.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/fmt.tld</taglib-uri>
            <taglib-location>/WEB-INF/fmt.tld</taglib-location>
        </taglib>
    </jsp-config>
        <resource-ref>
            <description>DB Connection</description>
            <res-ref-name>jdbc/SQLServerDB</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>
    </web-app>This should help....

  • How to run two files with same url-  urgent

    hi,
    i created two servlet page and both are working very fine.but at same time i only able to run one file with same url. Is possible to run two or more file at same time with same url name..
    if you r not understanding what i want to ask then, i have two file names under helloWeb directory
    1) helloWorld.java(servletname s1, url /man)
    2) helloWeb.java (servletname s2,url /man)
    to run - http://localhost:7001/helloWeb/man - it runs very first file which is added to deployment module.
    so i want to know how i can run both file with same url, for this what i have to pass on my address bar.
    plz help me i m wating
    <b></b>

    Hi,
    We can give same url mapping to both Servlets but we can access the servlet which is entered first in web.xml because whenever we send a request to the webserver then webserver look at the elements in web.xml file one by one.
    When it finds the corresponding url mapping then immediately sends the response to the client.The same url mapping for the next element will be ignored.
    I think there is no possibility to access both servlets with same url.
    Regards
    Anilkumar kari

Maybe you are looking for

  • Supplier Opening Balance Account wise

    Hi Team I would like to design a report which prints the Supplier Opening Balance Account wise along with the Total of Debits and Total of Credits for the Account selected. Example If user selects the Account Segment value : 142100 the report should

  • Keyboard mapping problem with sunstudio

    I'm a new sunstudio user and am having trouble with a setup issue. When I run sunstudio 11 from a sunray with a Sun keyboard all works fine (except the sunray has far too small of screen and it drive me crazy). When I run with my linux desktop being

  • Why won't any video clips load in Firefox from any site? Explorer works fine

    For some reason I can not get any of the videos to open up in any program. Has some setting changed not allowing this? Doesn't matter what type of video or specific site. My Explorer browser works fine. Should I remove Firefox and reinstall it?

  • Opening iPhoto automatically

    Okay, I figured out how to keep iTunes from automatically opening every time I connect my iphone to my computer. However, I can't seem to get iPhoto from opening automatically. Can It Be Done? (she said in a regal manner)

  • Process step for Investment Management

    Hi SAP Gurus Our client is into BOT projects - Build, operate adn transfer projects. Till the time of transfer the asset is the property of our client. So the client builds an assets, maintains & operates and transfers the rights only after certain y