Running Scripts with sqlplusw.exe

Hi,
My requirement is I've to run a script, which will take connection info (logon window) and then run my file.
much like sqlplusw.exe xx @c:\abc.sql. Now I can't put xx as username. I've to write it such a way that, it'll ask for conn info(username,password and connect string) then execute the script.
Thanks in advance.
--Sourav                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

D:\>type test.sql
conn &1/&2@&3
set lines 121 pages 1000 trimspool on
spool spool.log
select * from emp;
spool off
exit
D:\>sqlplusw /nolog @test.sql scott tiger test9i
D:\>type spool.log
     EMPNO ENAME      JOB              MGR HIREDATE        SAL       COMM     DEPTNO
      7369 SMITH      CLERK           7902 17/12/80        800                    20
      7499 ALLEN      SALESMAN        7698 20/02/81       1600        300         30
      7521 WARD       SALESMAN        7698 22/02/81       1250        500         30
      7566 JONES      MANAGER         7839 02/04/81       2975                    20
      7654 MARTIN     SALESMAN        7698 28/09/81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01/05/81       2850                    30
      7782 CLARK      MANAGER         7839 09/06/81       2450                    10
      7788 SCOTT      ANALYST         7566 19/04/87       3000                    20
      7839 KING       PRESIDENT            17/11/81       5000                    10
      7844 TURNER     SALESMAN        7698 08/09/81       1500          0         30
      7876 ADAMS      CLERK           7788 23/05/87       1100                    20
      7900 JAMES      CLERK           7698 03/12/81        950                    30
      7902 FORD       ANALYST         7566 03/12/81       3000                    20
      7934 MILLER     CLERK           7782 23/01/82       1300                    10

Similar Messages

  • Calling an rss script with rs.exe fails to result in a report pdf from VB6 w/ ShellEx.

    Sql 2008 R2
    Calling an rss script with rs.exe fails to result in a report pdf from VB6 w/ ShellEx. 
    If I call rs.exe with the various parameters from the command prompt I  have success(other than rs.exe using the temp folder, which is a different issue).  But when I try to execute the same process from a Visual Basic 6.0 application utilizing
    the ShellEx api call, the report creation and output to PDF format do not occur.   There is no error raised.
    Yes, I wish I could use a newer dev tool but that isn't an option right now. I think this should work.  Can ya'll tell me what I'm doing wrong?
    sArgs = "-i " & Chr(34) & "'C:\Program Files\Dura Supreme\OrderEntry\RunOrdReports.rss'" & Chr(34) & _
    " -s 'http://walnut/reportserver' -v 'DuraOrderNum=" & _
    Chr(34) & sOrdDuraID & Chr(34) & "' -e Exec2005 -t"
    ShellEx Chr(34) & "C:\Program Files\Dura Supreme\OrderEntry\rs.exe" & Chr(34), EShellShowConstants.essSW_SHOWNORMAL, sArgs
    TIA,
    Jim M.

    ShellEx Chr(34) & "C:\Program Files\Dura Supreme\OrderEntry\rs.exe" & ....
    Hello Jim,
    The path for rs.exe includes spaces, you should set it in hyphen, as you already did for file "RunOrdReports.rss" in variable "sArgs2
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Run script with flag

    Hi guys,
    is it possible run a script if a flag cell is selected ??
    another question...
    is it possible run script when i print a table or when i save file ???
    Thank's

    syrahBau wrote:
    Hi guys,
    is it possible run a script if a flag cell is selected ??
    Numbers is unable to trigger a script by itself.
    So you are free to run a script by yourself if this or that attribute is set.
    another question...
    is it possible run script when i print a table or when i save file ???
    You are perfectly free to run a script which will save a document an do this or that action.
    For the print task, at this time the response is yes but no.
    If your document contains a single sheet containing a single table, you may run a script to print the document and do this or that task.
    If the document doesn't match the given requirements, a script will print the entire document which is not what you asked for.
    From my point of view, it would be a good idea to
    _Go to "Provide Numbers Feedback" in the "Numbers" menu_,
    explain them that you want a feature allowing Numbers to trigger a script
    like the MACRO() function available in AppleWorks.
    Then, cross your fingers, and wait _at least_ for iWork'11
    Yvan KOENIG (VALLAURIS, France) mercredi 30 juin 2010 12:40:08

  • Run script with .pkb extension

    How do I run scripts from sql developer? I tried: file - open - mypackage.pkb. Opens file. When I do Run - Run File, I get: "The target metrics_pkg.pkb cannot be started because it is not a runnable target."
    Ok, maybe I should just use @mypackage.pkb as if I was in sqlplus. Nope. I have not told it where my script resides, so I get: "Unable to open file: "C:\Documents and Settings\mthompso\metrics_pkg.pkb".
    I assume there is some way to set the directory for running scripts?

    Couple of things to try here.. Don't use 'Run****' from the run menu. There is a green arrow on the editor that will only be available if a target is runnable.. If it is greyed out, you don't have a connection associated. Additionally, if the drop-down list on the upper right hand side doesn't show a connection, it won't run.
    And a hint to the development team.. please disable the run option under the run menu if it is not runnable :)
    Eric

  • Running a SqlPlus script with AT.EXE on WIN NT4.0

    Hi guys,
    I've to periodically run a simple batch script to update some tables on an Oracle DB. Since I'm
    running a Server Win NT4.0 SP6 I made a .cmd that calls a sqlplus script and I'm trying to
    schedule it using the AT.EXE service.
    When I run the .cmd outside from the AT it works fine; when I try to run it using AT something
    goes wrong and I got this error:
    ERROR:
    ORA-03113 end-of-file on communication channel
    I suspect it depends on how AT / sqlplus handle standard I/O but I wasn't able to find the
    right way to call them or a work around to make things work.
    Any suggestion ??
    TIA,
    Max
    Here's the script:
    @echo off
    rem
    rem run sql script (connect info in script)
    rem
    sqlplus -S /NOLOG @d:\UpdBatch\upd_table.sql %1 %2
    rem
    rem trace result in EventLong
    rem
    SET result=%ERRORLEVEL%
    IF '%result%'=='1' LOGEVENT -m \\MINERVA -s E -e 1 -r "BATCH UPDATE" "Error updating tables!"
    goto finished
    LOGEVENT -m \\MINERVA -s I -e 0 -r "BATCH UPDATE" "Tables Updated!"
    :finished
    echo "Done!"
    and I register it in AT in this way:
    D:>at 15:30 cmd.exe /C "d:\UpdBatch\my_script.cmd 10 20 > d:\temp\out.txt"
    null

    I did not notice that the cut and paste was poor. It should have read
    SQL> @dm$load.pkb
    SP2-0310: unable to open file "dm$load.pkb"
    SQL> host ls
    dm$load.pkb
    Any ideas will be greatly appreciated.

  • Running script with linux32 breaks package installs

    Hi,
    I'm running on an x86_64 system and I was trying to install the PPD and other files needed for my Panasonic KX-MB2030 printer.  I tried running the install script Panasonic provided, but it complained that it's not meant for an x64 system.  Then, I ran the script again with:
    linux32 ./install-linux
    The script ran, but now I cannot install any programs.  For instance, CUPS complained that libcups wasn't working properly (probably because the script overrode some of its files), but when I go to reinstall libcups, I get a message like this:
    :: package libcups-1.5.3.-5-i686 does not have a valid architecture
    I've tried installing other packages, but they all complain about how the i686 version of the package is not valid.  I tried to switch back using 'linux64', but Arch still won't let me install any packages.
    Please let me know if you have any suggestions.
    Thanks!
    Matt
    Last edited by stantheman286 (2012-07-08 15:56:20)

    Sure, here it is:
    #!/bin/bash
    # batch file to install Panasonic Printer Driver
    # Make sure only root can run our script
    if [ "$(id -u)" != "0" ]; then
    echo " Install MUST be run as root" 1>&2
    exit 1
    fi
    BUILD_CPU=i686
    TARGET_CPU=`uname -m`
    INSTALL_PATH="/usr/local/share/panasonic/printer"
    # check can install to thie system
    CAN_INSTALL=no
    FILTER_PATH_SEARCH=""
    MODEL_PATH_SEARCH=""
    case $TARGET_CPU in
    i[345]86)
    case $BUILD_CPU in
    i386)
    CAN_INSTALL=yes
    esac
    i686)
    case $BUILD_CPU in
    i[36]86)
    CAN_INSTALL=yes
    esac
    x86_64)
    case $BUILD_CPU in
    x86_64)
    CAN_INSTALL=yes
    esac
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/lib64/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/libexec64/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/local/lib64/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/local/libexec64/cups/filter"
    esac
    MODEL_PATH_SEARCH="$MODEL_PATH_SEARCH /usr/share/cups/model"
    MODEL_PATH_SEARCH="$MODEL_PATH_SEARCH /usr/local/share/cups/model"
    MODEL_PATH_SEARCH="$MODEL_PATH_SEARCH /usr/share/ppd"
    MODEL_PATH_SEARCH="$MODEL_PATH_SEARCH /usr/local/share/ppd"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/lib/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/libexec/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/local/lib/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/local/libexec/cups/filter"
    if test "x$CAN_INSTALL" != "xyes"; then
    echo "the package is build for $BUILD_CPU cpu, can not install to $TARGET_CPU system"
    exit 1
    fi
    # find install dir
    FILTER_PATH=""
    for DIR in $FILTER_PATH_SEARCH; do
    if test -d $DIR
    then
    FILTER_PATH=$DIR
    break
    fi
    done
    MODEL_PATH=""
    for DIR in $MODEL_PATH_SEARCH; do
    if test -d $DIR
    then
    MODEL_PATH=$DIR
    break
    fi
    done
    if test "x$FILTER_PATH" == "x"
    then
    echo " Cannot found CUPS filter path"
    exit
    fi
    if test "x$MODEL_PATH" == "x"
    then
    echo " Cannot found CUPS model path"
    exit
    fi
    FILTER_PROGRAMS="L_H0JDGCZAZ"
    # echo informations
    echo
    echo " start <Panasonic Printer Driver ($BUILD_CPU)> install......"
    # check and execute uninstall shell script
    if test -f $INSTALL_PATH/uninstall-driver
    then
    echo "find exist printer driver"
    echo " execute uninstall shell script now......"
    if !($INSTALL_PATH/uninstall-driver)
    then
    echo " uninstall old <Panasonic GDI Printer Driver> failed"
    echo " install driver failed"
    echo
    exit 1
    fi
    fi
    SCRIPT=`readlink -f $0`
    SCRIPTPATH=`dirname $SCRIPT`
    PWD=`pwd`
    cd $SCRIPTPATH
    # echo informations
    echo " start install files......"
    # make install dir
    mkdir -p $MODEL_PATH/panasonic/
    chown root:root $MODEL_PATH/panasonic/
    chmod 755 $MODEL_PATH/panasonic/
    mkdir -p $INSTALL_PATH/
    mkdir -p $INSTALL_PATH/bin
    mkdir -p $INSTALL_PATH/conf
    mkdir -p $INSTALL_PATH/data
    chmod 777 $INSTALL_PATH/conf
    # copy files
    # create uninstall script
    cat > $INSTALL_PATH/uninstall-driver <<\_______EOF
    #!/bin/bash
    # batch file to uninstall Panasonic Printer Driver
    # Make sure only root can run our script
    if [ "$(id -u)" != "0" ]; then
    echo " Uninstall MUST be run as root" 1>&2
    exit 1
    fi
    # echo informations
    echo
    echo " Confirmation"
    echo " <Panasonic Printer Driver> uninstall"
    echo
    echo -n " input 'y' to continue:"
    read inputval
    if test "$inputval" != "y"
    then
    echo " uninstall be canceled"
    echo
    exit 1
    fi
    # remove files
    echo " uninstall files......"
    # follow is created by install script
    _______EOF
    chmod 755 $INSTALL_PATH/uninstall-driver
    # copy lib files
    INSTALL_LIB_PATH="/usr/lib"
    RESTORECON=/sbin/restorecon
    LIB_FILES="L_H0JDJCZAZ"
    for file in $LIB_FILES; do
    cp ./lib/$file.so.1.0.0 $INSTALL_LIB_PATH/
    echo "rm -f $INSTALL_LIB_PATH/$file.so.1.0.0" >> $INSTALL_PATH/uninstall-driver
    ln -sf $file.so.1.0.0 $INSTALL_LIB_PATH/$file.so.1
    echo "rm -f $INSTALL_LIB_PATH/$file.so.1" >> $INSTALL_PATH/uninstall-driver
    ln -sf $file.so.1 $INSTALL_LIB_PATH/$file.so
    echo "rm -f $INSTALL_LIB_PATH/$file.so" >> $INSTALL_PATH/uninstall-driver
    done
    for file in $FILTER_PROGRAMS; do
    cp ./filter/$file $FILTER_PATH/
    echo "rm -f $FILTER_PATH/$file" >> $INSTALL_PATH/uninstall-driver
    if test -f $RESTORECON
    then
    $RESTORECON $FILTER_PATH/$file
    fi
    done
    # copy ppd files
    PPD_FILES=`find ppd -name *.ppd`
    for file in $PPD_FILES; do
    cp $file $MODEL_PATH/panasonic/
    file=`basename $file`
    echo "rm -f $MODEL_PATH/panasonic/$file" >> $INSTALL_PATH/uninstall-driver
    done
    echo "rmdir --ignore-fail-on-non-empty $MODEL_PATH/panasonic" >> $INSTALL_PATH/uninstall-driver
    # copy SPC & RCT files
    DATA_FILES=`find data`
    for file in $DATA_FILES; do
    if test -d $file
    then
    mkdir -p $INSTALL_PATH/$file
    else
    if test -f $file
    then
    cp $file $INSTALL_PATH/$file
    echo "rm -f $INSTALL_PATH/$file" >> $INSTALL_PATH/uninstall-driver
    fi
    fi
    done
    for file in $DATA_FILES; do
    if test -d $file
    then
    echo "rmdir --ignore-fail-on-non-empty -p $INSTALL_PATH/$file" >> $INSTALL_PATH/uninstall-driver
    fi
    done
    # copy tools
    cp ./panautil/L_H0JDUIZAZ $INSTALL_PATH/bin/
    echo "rm -f $INSTALL_PATH/bin/L_H0JDUIZAZ" >> $INSTALL_PATH/uninstall-driver
    cp ./panautil/L_H0JDUCZAZ $INSTALL_PATH/bin/
    echo "rm -f $INSTALL_PATH/bin/L_H0JDUCZAZ" >> $INSTALL_PATH/uninstall-driver
    chmod 4755 $INSTALL_PATH/bin/L_H0JDUCZAZ
    cp ./panautil/L_H0JDUIZAZ.png $INSTALL_PATH/bin/
    echo "rm -f $INSTALL_PATH/bin/L_H0JDUIZAZ.png" >> $INSTALL_PATH/uninstall-driver
    if test -d /usr/share/applications/
    then
    cp ./panautil/L_H0JDUIZAZ.desktop /usr/share/applications/
    echo "rm -f /usr/share/applications/L_H0JDUIZAZ.desktop" >> $INSTALL_PATH/uninstall-driver
    fi
    echo "rm -Rf $INSTALL_PATH/conf" >> $INSTALL_PATH/uninstall-driver
    echo "rmdir --ignore-fail-on-non-empty -p $INSTALL_PATH/bin" >> $INSTALL_PATH/uninstall-driver
    echo "rm -f $INSTALL_PATH/uninstall-driver" >> $INSTALL_PATH/uninstall-driver
    cat >> $INSTALL_PATH/uninstall-driver <<\_______EOF
    # restart
    echo " restart spooler - CUPS"
    if test -f /etc/init.d/cups
    then
    /etc/init.d/cups restart
    else
    if test -f /etc/init.d/cupsys
    then
    /etc/init.d/cupsys restart
    fi
    fi
    # echo informations
    echo
    echo " uninstall driver completed"
    echo
    echo " please use \"system-config-printer\" or \"lpadmin\" "
    echo " to remove all printers based on the driver."
    echo
    exit 0
    _______EOF
    # restart CUPS
    echo " restart spooler - CUPS"
    if test -f /etc/init.d/cups
    then
    /etc/init.d/cups restart
    else
    if test -f /etc/init.d/cupsys
    then
    /etc/init.d/cupsys restart
    fi
    fi
    cd $PWD
    # echo informations
    echo
    echo " install driver completed"
    echo
    echo " please use \"system-config-printer\" or \"lpadmin\" to add printer."
    echo
    exit 0

  • CS5 - Running Script with Action. Not saving problem

    I am trying to setup an action that runs a script using the "Insert menu item" command.
    It all works perfectly but when I quit Illustrator and re0open it, the action has disappeared.
    Is this a bug or am i doing something wrong?

    Additional info (no solution):
    Could have something to do with the order Illustrator registers available scripts as menu commands and checking validity of action 'menu commands'.
    Try this:
    - Look in the File/Scripts menu and note down a scriptname in there;
    - Exit Illustrator;
    - Start Illustrator
    - Create a new action
    - In the Action Panel flyout menu chose 'Insert Menu Item...' - a Find dialog should open
    - In the textbox enter the scriptname you dotted down and press Find
    It tells you 'No menu item matching that name was found.'
    - Press OK, then Cancel;
    - Goto File/Scripts but don't select a script, close the menu
    now again
    - Create a new action
    - In the Action Panel flyout menu chose 'Insert Menu Item...' - a Find dialog should open
    - In the textbox enter the scriptname you dotted down and press Find
    Now it could be found..
    So it seems that when Illustrator starts:
    Initializes without registering the available scripts as available menuitems
    When the actions are loaded and in it is a Menu Command, it checks if that command is actually available - if not it deletes the action item
    After accessing the scriptmenu the scripts are indeed registered as available menuitems..
    So now if they would only register the scriptnames before loading the actions when starting Illustrator it would be solved. Or of course disable checking action commands for validity.
    Sure hope they solve this soon as I can imagine it affects a lot of people.

  • Red field when I try to run script with 10G

    I recently installed 10G XE. I am able to create a new user and was trying to run a script for JustLeeBooks from the Thompson Course Technology books website. I downloaded the files to my computer and then went into the new user and browsed and downloaded the script. The area where the script appears is all red. When I click run, nothing happens. Should that script area be red like that?
    I can click on delete and delete the script, but I can seem to run the script.
    What do I need to do to run the script for my database class?
    Thank you.
    Vicki

    Hi,
    XE pre installed Apex is quite old and might not support all new browsers.
    Have you try use other browser?
    You can also upgrade Apex
    http://www.oracle.com/technetwork/developer-tools/apex/upgrade-apex-for-xe-154969.html
    But please note you lose database management features. But you can do those e.g. with SQL developer as above link shows.
    Regards,
    Jari

  • Running script with input values

    I have a script file FV.SQL with following contents:
    select * from emp where job in ( '&one' , '&two');
    in sqlplus it is ok to execute script by passing input values like
    SQL> @ FV CLERK ANALYST
    But how it can be executed in iSQLPLUS?
    Kindly suggest
    Message was edited by:
    Jameel

    Thanks,
    I am asking to do like this in iSQL*PLUS,
    SQL> ED V
    SQL> ED
    Wrote file afiedt.buf
      1  SELECT * FROM DEPT
      2* WHERE LOC IN ('&1' , '&2')
    SQL> @ V CHICAGO DALLAS
    old   2: WHERE LOC IN ('&1' , '&2')
    new   2: WHERE LOC IN ('CHICAGO' , 'DALLAS')
        DEPTNO DNAME          LOC
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
    --- "when i try the same in isqlplus, it shows error...?"Message was edited by:
    Jameel

  • Windows 8.1 Batch Scripts for devcon.exe

    HiI'm using batch script with devcon.exe for cleaning usb ghost devices. On XP and Win 7 it works perfect but on windows 8.1 only if i manualy paste commands on "administrator command line" but it wont start from my batch script. Is there any solution for windows 8 to enable security rule for batch script? Win 8 is so annoying for any type of scripts even gpo. At the moment im trying to resolve this problem with PowerShell.This is how script looks like:
    Text@echo offDEVCON Find * | FIND /I /V "matching device(s)" > "%Temp%\DevconFind.txt"FOR /F "tokens=1 delims=: " %%A IN ('DEVCON FindAll * ^| FIND /I /V "matching device(s)"') DO (TYPE "%Temp%\DevconFind.txt" | FIND "%%~A" >NULIF ERRORLEVEL 1 %Debug% DEVCON Remove "@%%~A")DEL "%Temp%\DevconFind.txt"
    Regards
    This topic first appeared in the Spiceworks Community

    Uninstall it.  Reboot.  Then install.  Reboot.
    All of this should be done as Run as Administrator or it will fail.
    16GIG or Larger usb flash drive is required.  8 gigs is too small.
    http://www.dell.com/support/home/us/en/19/Drivers/DriversDetails?driverId=8HY96

  • How to run scripts ?

    I would like to know how to run scripts with xgrid.
    From the Xgrid Admin manual, page 37, I created a file and added
    !#/bin/sh
    /bin/echo "Hello, World!"
    saved the file, and gave chmod 755 hello.sh
    When I run at the command line, "Hello, World" is displayed. But as Apple mentioned in the same page of the manual, I did this at the command line
    xgrid -h localhost -p mypassword job submit hello.sh
    Job id is displayed. Say it is 67.
    I could see in the Admin interface that job is sumbitted and running. After finishing, at the command line I did a
    xgrid -h localhost -p mypassword job results -id 67
    Nothing is displayed. Am I doing right or missing something ?
    Appreciate any help.

    A little comment: add to your bashrc file (in /etc/)
    export XGRIDCONTROLLERHOSTNAME=yourcontroller
    export XGRIDCONTROLLERPASSWORD=yourpass
    so that you don't need to use -h and -p options all the time.
    Am I wrong or shouldn't your commands be -job (notice the dash before job)?
    I suppose because otherwise you would get a help page. Also, I suppose your beggining of file is #! instead of the inverse...
    Did you try using run instead of submit? You should see the output right away.
    What is the status of the job in Xgrid Admin? What happens if you use -so to direct the output to some file?

  • What is the best way to run a powershell script with parameters in the Task Scheduler?

    Hello, 
    Want to run the following from a scheduled task in the Task Scheduler on a server.  What is the best approach?
    .\pscript.ps1 -csvfile "\\Srv1\Share\File.txt"
    Thanks for your help! SdeDot

    Hi,
    To run a powershell script with parameters in the Task Scheduler:
    Program: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Add argument (optional): -Command "& c:\scripts\test.ps1 -par1 2 -par2 3"
    Hope the below two articles be helpful for you:
    Schedule PowerShell Scripts that Require Input Values
    https://blogs.technet.com/b/heyscriptingguy/archive/2011/01/12/schedule-powershell-scripts-that-require-input-values.aspx
    How to Schedule a PowerShell Script
    http://dmitrysotnikov.wordpress.com/2011/02/03/how-to-schedule-a-powershell-script/
    Regards,
    Yan Li
    Regards, Yan Li

  • Is it possible to have a keyboard shortcut run a script with CS6?

    I see there is an option for it to go to "other scripts" with a keyboard shortcut, but that really doesn't help much. I want it to play a specific script that is already loaded. Thanks in advance!!

    I'm working on something very similar right now.
    Written in AHK.
    so win only sorry Macsters...
    Scans a folder of your scripts and displays them in a panel (see above)
    you can click any one like a button.
    or you can eg. 3 enter.
    Panel can be dragged to where ever you want it.
    Still playing with the finishing touches and will post the finished result once I am done.
    That will be next year some time, as I am finished work for the year.
    Run, % "[Full path to]\Illustrator.exe " Scriptlocation JSName
    this is my AHK line to run the script.
    any reason for the cmd.exe section

  • 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.
    ¯\_(ツ)_/¯

  • Lightroom 5.2 running Video (MOV) sometimes gets bogged down with dynamiclinkmediaserer.exe taking u

    Lightroom 5.2 running Video (MOV) sometimes gets bogged down with dynamiclinkmediaserer.exe taking up 88% of the cpu time.  This was a bug in Lightroom 4.  When will it be fixed?

    Running the script by python2 solves it for me:
    su - mythtv -c "nice -n 19 python2 /usr/bin/tv_grab_nl_py --output ~/listings.xml"
    Best regards,
    Cedric

Maybe you are looking for

  • No DTD validation in SAX Parser

    I have a xml document which has a DocTYpe spec in it with a DTD reference, but the dtd file itself is not there. We tried to parsing it in Non validating mode , but it throws a fileNot Found Exception looking for the DTD file. we tried it on the SAXS

  • Pop up with Express document 'update was terminated' received from author.

    Hi , I am creating business partner in sold-to-party role and then creating another business partner in contact person role . after this I am creating relationship between those BPs by using FM  BAPI_BUPR_CONTP_CREATE (tried  FM BAPI_BUPR_RELATIONSHI

  • Issues after Migration - Session Loader fails

    Just migrated to 9051 JDev : Caused by: Exception [TOPLINK-7095] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ValidationException Exception Description: The session.xml resource [sessions.xml] was not found on the resour

  • Tech Tool Deluxe DVD won't boot with 10.5.6. How to fix volume structure?

    Is it just my newbieness, or is the Tech Tool Deluxe 3.1.2 DVD image not bootable with late 2008 MBP with OS X 10.5.6? I installed Tech Tool Deluxe 3.1.2 to Leopard 10.5.6. - ran it and it said I have problems with my volume structures. I followed th

  • How to return more data from function

    Following is the scenario: CREATE OR REPLACE TYPE OBJ IS OBJECT TEST_ID NUMBER(9), TEST_DESC VARCHAR(30) CREATE OR REPLACE FUNCTION FN_MY_DATA RETURN OBJ AS OBJ1 OBJ; BEGIN OBJ1.TEST_ID := 444; OBJ1.TEST_DESC := 'FFF'; RETURN OBJ; END; I WANT USED VA