Running a script with comments in it

Hello everybody.
I have a script file that has multi-line comments embraced within /* and */.
When I fetch it into the sql-buffer using the GET command and run it, it is giving me an error.
I'm providing the details of my query.
This is my script file:
     Whenever we use an UNION in a query, ORDER BY clause
     can appear only once and that too in the sub-query
     that follows the UNION keyword.
     The query takes the column names of the first sub-query.
     Hence the ORDER BY clause should contain the column names
     of the first sub-query.
     In the query that follows
     ORDER BY 1 and
     ORDER BY last_name
     produces the same result, while
     ORDER BY first_name
     results in an error saying that it is an unidentified column.
SELECT last_name, hire_date
FROM employees
WHERE department_id = 90
UNION
SELECT first_name, hire_date
FROM employees
WHERE first_name LIKE 'K%'
ORDER BY 1
This is my SQL session:
SQL> GET order_by_union_rule.sql
1 REM
2 /*
3 Whenever we use an UNION in a query, ORDER BY clause
4 can appear only once and that too in the sub-query
5 that follows the UNION keyword.
6 The query takes the column names of the first sub-query.
7 Hence the ORDER BY clause should contain the column names
8 of the first sub-query.
9 In the query that follows
10 ORDER BY 1 and
11 ORDER BY last_name
12 produces the same result, while
13 ORDER BY first_name
14 results in an error saying that it is an unidentified column.
15 */
16 SELECT last_name, hire_date
17 FROM employees
18 WHERE department_id = 90
19 UNION
20 SELECT first_name, hire_date
21 FROM employees
22 WHERE first_name LIKE 'K%'
23* ORDER BY 1
24
SQL> /
REM
ERROR at line 1:
ORA-00900: invalid SQL statement
Should I remove the comments before running the sql query?
Or is there any wrong with my query?
Please help me out.
HAVE A NICE DAY!

Hi,
Try this out.I hope it 'll work fine.
--REM
Whenever we use an UNION in a query, ORDER BY clause
can appear only once and that too in the sub-query
that follows the UNION keyword.
The query takes the column names of the first sub-query.
Hence the ORDER BY clause should contain the column names
of the first sub-query.
In the query that follows
ORDER BY 1 and
ORDER BY last_name
produces the same result, while
ORDER BY first_name
results in an error saying that it is an unidentified column.
SELECT last_name, hire_date
FROM employees
WHERE department_id = 90
UNION
SELECT first_name, hire_date
FROM employees
WHERE first_name LIKE 'K%'
ORDER BY 1

Similar Messages

  • Run several scripts with one master script or an automator workflow?

    I have several scripts that I need to run all at once...
    Could I make a script that would run all the other scripts, then bundle everything into an application( or something similar) so all my scripts would run with just a double click...
    Any ideas?

    Yes, this is possible. Save your master script as either an application or a script bundle (whichever is most convenient). Then, save all of your subscripts inside the bundle.
    You can then load and run the scripts from your master script. The following code does that:
    set aScriptFile to load script file (path to me as string) & "Any additional subfolders" & "Script File Name.scpt"
    run aScriptFile
    Note that "path to me" will not work properly when the script is run from within script editor. It will, however, work when run from the script menu. See the following for a discussion of that:
    http://discussions.apple.com/message.jspa?messageID=2789538

  • 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

  • Modifying /etc/passwd to run a script (with logging)

    This is not Arch related so feel free to ignore...
    The goal is to modify a users /etc/passwd entry so it runs a script instead of a shell.
    As a proof of concept, this works:
    #!/bin/bash
    read -p "Enter your selection: " selection
    case "$selection" in
    1) /usr/bin/ssh [email protected];;
    *) exit 0;;
    esac
    If I su to a user with that as their "shell" I see the prompt, I can press 1 and login to the remote box
    Then I thought I'd try to add some logging and script became this:
    #!/bin/bash
    read -p "Enter your selection: " selection
    case "$selection" in
    1) /usr/bin/script -c "/usr/bin/ssh [email protected]";;
    *) exit 0;;
    esac
    This does work when run directly at the command line but does not work when set as a users shell in /etc/passwd... it's like it executes the script over and over again.  The output is:
    Enter your selection: 1
    Script started, file is typescript
    Enter your selection: 1
    Script started, file is typescript
    So adding the /usr/bin/script to the mix is causing a problem.
    What is the cause?  I'm assuming it's something to do with subshells but I thought the '-c' would resolve that.
    How can I make it do as expected (without modifying .profile if possible.)  The end-goal is for users to log in and be presented with a list of servers to connect to
    Is there a better way to accomplish this?
    Last edited by oliver (2015-01-20 16:38:11)

    I'm trying to avoid modifying profiles due to the archaic way we handle user accounts at work... it would be one more thing to maintain but it's certainly not impossible.
    I think I will switch to /bin/sh anyway - just used bash out of habit
    And reading the first post back, I'm not sure it's entirely clear... but it works at the command line and only fails when it's set as a user's shell.  I'm not sure what the difference is
    Last edited by oliver (2015-01-20 16:51:48)

  • Trouble using Run Shell Script with python in Automator

    Hi. I have a python script I want to run in Automator (update_puzzles.py). All it does is check, rearrange and update files and there is not supposed to be any input. I can get the script to run outside of Automator, in Terminal, by navigating to the right directory and typing "python update_puzzles.py"
    I must not be setting up Run Shell Script correctly. I have it set to /bin/bash and Pass Input to stdin. The command line simply reads python /pathname/update_puzzles.py (where pathname is the path to the .py file, which I got by dragging the file onto the Run Shell Script command window). There are no actions before this in my workflow and the action after is View Results.
    The log says Run Shell Script failed, and the error is "Traceback (most recent call last):"
    Any suggestions?
    Thanks so much.

    If the script is expecting to do stuff with files in the same directory as the executable, you will probably need to add a statement to change to the appropriate working directory. The shell used in the Automator *Run Shell Script* action is a generic one that does not share any of the environment variables that the Terminal uses.

  • How to run .tcl scripts with VTK?

    I have a bunch of .tcl scripts that use VTK. How do I run them? I have tcl/tk/vtk installed, but when I try to run `tclsh script.tcl` it outputs errors about VTK. On other distros i saw a binary named `vtk` that could run .tcl scripts out of the box. Is there something like this on Arch?
    Thanks.

    Hi, vtk is in community. It should supply the tcl bindings. I once was the maintainer when it was in AUR. It works here with the tcl examples that come with the vtk package. Have not tested the version in community yet.

  • RUNNING PHP SCRIPT WITH ZEND FRMWRK IN WINDOWS TASK SCHEDULER

    I have a PHP script which includes the Zend framework Mail.php for sending mails.
    I am running a WAMP server and i used DW to create it.
    I want to run my script in every 5 mins, How i can schedule it in Windows task scheduler.
    I tried running a bat which contains the php.exe path and arguments as php file but it gives an error that zend/mail.php not found.
    Please help its really urgent.

    Thanks for your response.
    bat file has:
    path of the php.exe -f path of php file.
    But when it runs it gives an error that the zend framework file not found.
    I have a seperate PHP includes folder under which zend FW is stored.
    That folder is marked in includes_paths in php.ini.

  • Can you run Action Scripts with Adobe Photoshop Elements 8?

    I have Photoshop Elements 5 and i cant find the 'Action' tab. Im considering buying Elements 8 but ONLY if i know for sure if i can use action scripts with it.
    Message was edited by: Jochem van Dieten

    Elements does not include Photoshop's Actions Palette function.  You can get an add on for elements that will is able to Play some Photoshop Actions in Elements. Not all Photoshop Actions actions can be played for some action use Photoshop features that are not in Elements like Photoshop Scripting. http://help.adobe.com/en_US/PhotoshopElements/8.0/Win/Using/WS961FF412-5006-4364-B315-1576 62B1F7E9.html
    http://hiddenelements.com/
    http://www.photokaboom.com/photography/learn/Photoshop_Elements/actions/1_actions.htm

  • Setup JOB to run sh script with argument

    Hi all,
    Can anyone share your view and experience on How to setup Job to execute shell script with argument?
    For example : I need to execute /export/home/joel/test.sh 20060921
    20060921 is the argument.
    If I define a program to execute the script, can I use DEFINE_PROGRAM_ARGUMENT to set the argument?
    I am not sure because I have the understanding that it will only work with STORED_PROCEDURE program type.
    How does Oracle Scheduler handle such case?
    I really appreaciate your response.
    Thanks

    Hi,
    The thread above contains information specific to shell scripts. For stored procedures you just set job_type to 'stored_procedure' , number_of_arguments to the number of arguments that you want to pass into the stored procedure and then call set_job_argument_value for each argument before finally enabling the job . So for example
    begin
    dbms_scheduler.create_job(
    job_name=>'j1',
    job_type=>'stored_procedure',
    job_action=>'dbms_output.put_line',
    number_of_arguments=>1);
    dbms_scheduler.set_job_argument_value('j1', 1, 'this is my argument');
    dbms_scheduler.enable('j1');
    end;
    Hope this helps,
    Ravi.

  • Memory Error in Bridge while running a script with multiple moveTo()'s.

    I have written a script to create folders based on the names of assets in the parent folder, then move the assets with matching names into the appropriate folders. The script runs perfectly up to somewhere between 1,000 to 1,500 images moved and then I receive a memory error from Bridge.
    I have been running this on folders with an excess of 25,000 assets in them. My work around was to put a simple counter in the script to let me know when 1,000 assets had been moved, throw up an alert, and then I would view the Task Manager to let me know when the CPU usage had dropped below 50% and would ok the alert, then it would run the next 1000 assets.
    My question, is it possible in scripting to monitor your memory usage to allow a pause in the script so Bridge processing can catch up?

    Don't do that!
    $.sleep() doesn't "sleep". ExtendScript is not multi-threaded. $.sleep just waits on the $.sleep() command to execute. It actually blocks all processing rather than free up the processor to do things like garbage collection.
    First try the $.gc() command. To my knowledge there is no way to track ES' memory usage.
    If that doesn't work, try scheduling a task...
    Let's say that you find that after 1000 moves, it takes 60 seconds for the processor to cool off:
    doAThousandMoves = function() {
    // execute 1000 moves
    app.scheduleTask( "doAThousandMoves()", 60000, true );
    The way I would actually code this is to scan the folder tree and create a global array that contained all of the files to be moved.
    I would then move them 1 at a time, shifting them off the array. Something like this:
    var mover = {}; // global object declaration
    mover.init = function() {
    mover.files = new Array();
    // fill mover files with the file objects to be moved.
    app.scheduleTask( "mover.move()", 10 );
    mover.move = function() {
    var i = 0;
    while ( i++ < 1000 ) {
    file = mover.files.shift();
    // move file
    if ( mover.files.length > 0 ) {
    app.scheduleTask( "mover.move()", 60000 );
    In fact, you should probably break this into chunks of about 10 or so at a time (you can reduce the gap between calls). Doing so will make the operation appear to be running as a background process.
    Regards
    Bob

  • How to run custom scripts with KRunner

    Hi!
    I'd like to run my custom scripts, kept within ~/linux/bin, with KRunner. Is there any way to enter just script name instead of whole path? Something like editing $PATH in .zshrc maybe?
    Cheers
    vi3dr0

    from a quick google-trip it seems Krunner doesn't always respect $PATH.
    as a workaround found here you might [re]set you're $PATH in a script inside ~/.kde/env/ to see if that takes affect for KRunner
    my link wrote:If you would like to affect the global environment of your KDE session, and are not using a custom session, you can place files in ~/.kde/env. Files ending in ".sh" are read and executed in the same shell that is reading and executing the startkde script.

  • 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 file (script) with systemd.

    Hi, i created a file resposible for setting up wireless connection:
    #!/bin/bash
    ip link set wlp12s0 up
    wpa_supplicant -B -Dwext -i wlp12s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
    dhcpcd wlp12s0
    Then i saved it as internet.run into /usr/lib/systemd/system/internet.run, then i typed as root:
    systemctl enable internet.service
    I had of course internet.service file there too, with nothing special (filled descprition in [Unit] section, and ExecStart in Service), and I didn't work.... I know that the internet.run is written properly because if i type line by line it as root i works fine, but with systemd during boot it don't...

    There is a [email protected] and a [email protected], there is no need to set up any custom scripts.
    systemctl enable dhcpcd@wlp12s0
    You will have to symlink wpa_supplicant manually because the [Install] section still has wlan0 hardcoded.
    ln -s /usr/lib/systemd/system/[email protected] /etc/systemd/system/multi-user.target.wants/[email protected]
    Then set up the config in /etc/wpa_supplicant/wpa_supplicant-wlp12s0.conf.
    The service file probably doesn't work because you haven't specified Type=forking, so systemd will kill the processes after they have forked. But as said, you don't need any custom service.

  • Running powershell script with customer parameters as a scheduled task

    tfl wrote:I guess I don't get why you are wanting thisMy regular tasks run,. and take data from data files. Want your batch to get processed today? Then add it to the queue file by 5:00 PM.. The task runs at 5:01 and works with whatever data is available. And if the file is empty, nothing happens each night. If you want to pass parameters like this, then why bother with a scheduled task? You'd need to remove the old one and add the new one each time. Which is extra work and complexity, especially if the task at hand is in any way 'dangerous' if run twice with the same data (ie you forget to change the task or remove it).I'm using a scheduled task to trigger the script, I'm using the "on event" trigger and then calling the script as an action. The method I was using before (calling via a bat file with the event Id hard coded into that"...

    Hi all,Having one of those hair pulling issues where something should work but for some reason its blindly refusing not to!I've created this script that is a bit of an extension to the email on eventID for task scheduled. It basically pulls out the various information from the actual event and fires off an email to our alerting team to investigate etc.That all works great, but what I'm now trying to do is get it to accept a custom parameter so the actual event ID its looking for doesn't have to be hard coded and can be passed to it via the commandline etc. I've got it all setup and work great but for the life of me can't get it to work correctly when set as a scheduled task. This is what the command basically looks like:powershell -executionpolicy bypass -command "& 'pathtofile\script.ps1' -evtid 8004"The latter part is the customer...
    This topic first appeared in the Spiceworks Community

  • Running python script with system arguments from applescript

    Hi,
    I am trying to run a python code from within applescript. A string should be passed as an argument to the python script, i.e. from the terminal, I would do the following
    cd /Users/thatsme/Library/Scripts/myfolder
    python my_python_file.py abcdefg
    There are two ways I figure I could do this in applescript. "abcdefg" are contained in the variable strNote
    a) directly:
    do shell script "cd /Users/thatsme/Library/Scripts/myfolder; python my_python_file.py " & strNote
    b) calling Terminal
    tell application "Terminal"
      activate
              do script "cd /Users/claushaslauer/Library/Scripts/OO_latex; python my_python_file.py " & strNote
    end tell
    I would prefer option a) as I don't really want to have Terminal windows popping up. The strange thing is, that I see in the applescript results window the result of the print statements in the python script, but no output is generated (the python script contains a few os.system() commands.
    Option b) does what it is supposed to be doing, however, applescript does not wait until the script is finished running.
    Why does option a) nor work, and what do I need to change to make it work?

    Thank you guys for your help, this is really weird.
    Here is my full applescript
    set strNoteQ to "1+1=2"
    (* for whatever reason, this does not work *)
    do shell script "cd /Users/claushaslauer/Library/Scripts/OO_latex; python create_latex_pdf.py " & strNoteQ
    Below is my python skript.
    When I call it as
         python create_latex_pdf.py 1+1=2
    it creates a wonderful pdf.
    With the applescript above, it prints the print statements, it also generates the latex file temp.tex -- correctly, so I assume the string in this example is ok.
    However, it does not execute the latex related commands (the three os.system calls)
    Is it not a good idea / not possible to execute os.system in a python script that is called from applescript? <sorry if I had brought all the attention to the string issue>
    here is the python script:
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    import sys
    import os
    import datetime
    import time
    def main():
        str_latex_note = sys.argv[1]
        print "%s" %  str_latex_note
        preamble = """\documentclass{article}
    \usepackage{amsmath,amssymb}
    \pagestyle{empty}
    \\begin{document}
    {\huge
    %s
    \end{document}"""% (str_latex_note)
        ## write latex file
        cur_path = r'/Users/mypath/Library/Scripts/OO_latex'
        cur_file = "temp.tex"
        fobj = open(os.path.join(cur_path, cur_file), 'w')
        fobj.writelines(preamble)
        fobj.close()
        ## process latex file
        print cur_path
        os.chdir(cur_path)
        cmd = 'latex temp.tex'
        print cmd
        print "running latex"
        os.system(cmd)
        cmd2 = 'dvips -E -f -X 1200 -Y 1200 temp.dvi > temp.ps'
        print "running dvips"
        os.system(cmd2)
        cmd3 = 'epstopdf temp.ps'
        print "running epstopdf"
        os.system(cmd3)
        print "done!"
    if __name__ == '__main__':
        main()

Maybe you are looking for

  • When I Preview or Publish my Project it shows a blank white screen

    I created a projected, successfully published it as a SWF and everything worked fine. Now when I go back to edit and try to preview the project or individual slides it just shows me a blank white slide, even the captivate skin with toggles that I cho

  • Motion 4 Opinion

    I am sure this has been asked numerous times before, but believe it or not it is not easy finding the right information about this subject. I am a film student and am studying all aspects of filmmaking. One of them is compositing, editing and digital

  • Use of Forum Points....

    Hello everyone, Since i registered for SDN i m seeing people who earned lot of forum points....few has in the range of 10000 also ....are these points really helpful in future ??...and in which manner these points will help ?? thnx.

  • SPEAKER DISTORTION from TImeline Play in FCP HD

    M-AUDIO BX5a speakers hooked up. Sound fine playing in other applications. Distorted, low and slow when outputting from FCP. Please any help,out there? Hooked through DigiDesign M-Box. Downloaded and use Core Audio Standalone Driver.

  • Can I limit incoming file sizes ?

    Is there anyway to tell mail to bounce any email that contains an attachment over say 2MB? I've looked through all the control panels in mail rules and can't find anything