Run 5 commands in parallel using scriptblock

Hi,
I have an array of 10000 commands that I want to process through an application, but only 5 commands in parallel at the same time. So I will take 5 commands from the array $arrCommands, then run those in parallel, then take another 5 commands..process..and
so on.. I might have to use "scriptblock" functionality, but with current setup the chance is it will try to run thousands commands in parallel which will actually kill the server. I won't use "Foreach -parallel" because my server running
Powershell V2.
Can anyone suggest how can I use scriptblock functionality to receive and process 5 commands in parallel?
## Function to process commands
Function ProcessCommands
param
[string]$ParamCommand
[hashtable]$Return = @{}
    $objProcess = New-Object System.Diagnostics.Process
    $objProcess.StartInfo = New-Object System.Diagnostics.ProcessStartInfo
    $objProcess.StartInfo.FileName = "\\OFCAPPSRVR\apps\calcrun.exe"
    $objProcess.StartInfo.Arguments = $Parameter
    $objProcess.StartInfo.UseShellExecute = $shell
    $objProcess.StartInfo.WindowStyle = 1
$objProcess.StartInfo.RedirectStandardOutput = $true
$null = $objProcess.Start()
$objProcess.WaitForExit()
$ExitCode = $objProcess.ExitCode
$StandardOutput = $objProcess.StandardOutput.ReadToEnd()
$objProcess.Dispose()
$Return.ExitCode = $ExitCode
$Return.StandardOutput = $StandardOutput
Return $Return
## Main
$arrCommands = @(
"STD -iMXB9010 -o\\OFCAPPSRVR\outputs\MXB9010.pdf",
"STD -iMXB6570 -o\\OFCAPPSRVR\outputs\MXB6570.pdf",
"STD -iMXB8010 -o\\OFCAPPSRVR\outputs\MXB8010.pdf",
"STD -iMXB5090 -o\\OFCAPPSRVR\outputs\MXB5090.pdf",
"STD -iMXB2440 -o\\OFCAPPSRVR\outputs\MXB2440.pdf",
"STD -iMXB8440 -o\\OFCAPPSRVR\outputs\MXB8440.pdf"
foreach ($Command in $arrCommands)
$Return = ProcessCommands -ParamCommand $Command
$arrResults += New-Object Psobject -property @{COMMAND=$Command; EXITCODE=$Return.ExitCode; OUTPUT=$Return.StandardOutput}

I think the method described in this blog is your best bet:
http://blogs.msdn.com/b/powershell/archive/2011/04/04/scaling-and-queuing-powershell-background-jobs.aspx
I hope this post has helped!

Similar Messages

  • Error running SQL and EXEC commands in parallel

    Dear Gurus,
    We are applying 3480000 and in process as soon as workers start it come out of adpatch session and give su the following error:
    ************* Start of AD Worker session *************
    AD Worker version: 11.5.0
    AD Worker started at: Sun Sep 02 2007 23:11:01
    APPL_TOP is set to /sgmtemp/prodappl
    Worker process 4 started.
    Checking if all jobs have their actual and symbolic arguments in sync....
    Done.
    Writing jobs to run to restart file.
    Reading jobs from FND_INSTALL_PROCESSES table ...
    Done reading jobs from FND_INSTALL_PROCESSES table ...
    Telling workers to read 'todo' restart file.
    Done.
    Starting phase 0 (A0): first
    There are now 98197 jobs remaining (current phase=A0):
    0 running, 123 ready to run and 98074 waiting.
    Assigned: file adsysapp2.sql on worker 1 for product admin username APPLSYS.
    Assigned: file cssruwq1.sql on worker 2 for product cs username CS.
    Connecting to CSD......Unable to connect.
    AutoPatch error:
    The following ORACLE error:
    ORA-01017: invalid username/password; logon denied
    occurred while executing the SQL statement:
    CONNECT CSD/*****
    AutoPatch error:
    Error while evaluating "Check Object"
    Telling workers to quit...
    3 workers have quit. Waiting for 1 more.
    All workers have quit.
    Error running SQL and EXEC commands in parallel
    You should check the file
    /sgmtemp/prodappl/admin/msbep004/log/3480000_sbm3.log
    for errors.
    applmgr@21:/sgmtemp/Oglupgr/3480000>
    What could be the issue, i tried to connect CSD/CSD in sql and it connected.
    Thanks in Advance
    Regards
    Kiran Rana

    Hi Gurus,
    Even i tried to recreate the FND_GLOBAL by performing the following, but still no luck:
    output for scripts hearder value in FND_TOP:
    applmgr@21:/sgmtemp/prodcomn/temp> cd $FND_TOP/patch/115/sql
    applmgr@21:/sgmtemp/prodappl/fnd/11.5.0/patch/115/sql> grep Header AFSCGBL*
    AFSCGBLB.pls:/* $Header: AFSCGBLB.pls 115.78 2005/03/21 11:40:02 vbalakri ship $ */
    AFSCGBLS.pls:/* $Header: AFSCGBLS.pls 115.33 2004/06/30 05:00:18 rsheh ship $ */
    Output for script header value in Database:
    SQL> select text from dba_source where name='FND_GLOBAL' and line <5;
    TEXT
    package FND_GLOBAL as
    /* $Header: AFSCGBLS.pls 115.33 2004/06/30 05:00:18 rsheh ship $ */
    package body FND_GLOBAL as
    /* $Header: AFSCGBLB.pls 115.78 2005/03/21 11:40:02 vbalakri ship $ */
    8 rows selected.
    We tried to re-apply 4 hours back when one of the support personnal ask use to run those
    scripts. one of them went with out any errors but second one went with errors
    as follows:
    First Script @AFSCGBLS.pls
    applmgr@21:/sgmtemp/prodappl/fnd/11.5.0/patch/115/sql> sapps @AFSCGBLS.pls
    SQL*Plus: Release 8.0.6.0.0 - Production on Mon Sep 3 03:24:10 2007
    (c) Copyright 1999 Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
    With the Partitioning and Oracle Data Mining options
    JServer Release 9.2.0.7.0 - Production
    DOC> | Copyright (c) 1993 Oracle Corporation Redwood Shores, California, USA|
    DOC> | All rights reserved. |
    DOC> +=======================================================================+
    DOC> | FILENAME
    DOC> | AFSCGBLS.pls
    DOC> |
    DOC> | DESCRIPTION
    DOC> | PL/SQL specification for package: FND_GLOBAL
    DOC> |
    DOC> | NOTES
    DOC> | This module is called by AutoInstall (afplss.drv) on install and
    DOC> | upgrade. The WHENEVER SQLERROR and EXIT (at bottom) are required.
    DOC> |
    DOC> | HISTORY
    DOC> | June, 1999 - Added function AUDIT_ACTIVE, bug 879630. Jan Smith.
    DOC> | 11/19/01 MSkees - Added DBDrv line and 'SET VERIFY OFF' for ARU auto
    DOC> | generation bug 2047263 build
    DOC> |
    DOC> *=======================================================================*/
    Package created.
    Commit complete.
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
    With the Partitioning and Oracle Data Mining options
    JServer Release 9.2.0.7.0 - Production
    Second Script AFSCGBLB.pls:
    applmgr@21:/sgmtemp/prodappl/fnd/11.5.0/patch/115/sql> sapps @AFSCGBLB.pls <
    SQL*Plus: Release 8.0.6.0.0 - Production on Mon Sep 3 03:27:15 2007
    (c) Copyright 1999 Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
    With the Partitioning and Oracle Data Mining options
    JServer Release 9.2.0.7.0 - Production
    Warning: Package Body created with compilation errors.
    Commit complete.
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
    With the Partitioning and Oracle Data Mining options
    JServer Release 9.2.0.7.0 -
    Production
    applmgr@21:/sgmtemp/prodappl/fnd/11.5.0/patch/115/sql>
    The second script (AFSCGBLB.pls) run's out with errors and changes status of almost 15000 objects as INVALID in database.
    Regards
    Kiran Rana

  • Use SMA to run commands inside VM created from WAP

    Hello,
    I didnt find any SMA specific forum, so I post here.
    Im new to SMA and have a question that I cant find the answer to.
    We are about to deploy a new Hyper-V/SC/WAP enviroment.
    We use virtual networks and I have problem to connect and execute powershell on the virtual machines.
    I want to do some cutomizations on the VM after they are deployed (Windows Server 2012R2) from a Gallery item in WAP.
    In VM Clouds in Service Management Portal I have activated an Automation with Object = MicrosoftCompute VMRole and Action = Create.
    In my Runbook I check the status on the creation of the VM and when the status is complete I want to execute some powershell on the new server.
    So far so good, but here is my problem, I cant connect to the new VM.
    I have tried:
    $ComputerName = $ResourceObject.ComputerName
    InlineScript {
    Get-Service | Out-File “c:\test.txt”
    } -PSComputerName $ComputerName
    I have tired to add -PSCredential after -PSComputername aswell.
    The Runbook will enter a Suspended state with the following exception:
    Connecting to remote server Fredrik-Test failed with the following error message : WinRM cannot process the request. The following error occured while using Kerberos authentication: Cannot find the computer Fredrik-Test.
    It looks like SMA have no clue how to access the new VM.
    I went to the VMM server and ran the following script:
    $adminpasswd = ConvertTo-SecureString “xxxxx” -AsPlainText -Force
    $adminCredentials = New-Object System.Management.Automation.PSCredential (“administrator”, $adminpasswd)
    $VM = Get-SCVirtualMachine | Where-Object {$_.Name -eq ‘Computer013′}
    Invoke-Command -Computername $VM.ComputerName -ScriptBlock {Get-Service | Out-File “c:\test.txt”} -credential $adminCredentials
    And there I got same error:
    [Computer013] Connecting to remote server Computer013 failed with the following error message : The WinRM client cannot process the request because the server name canno
    t be resolved. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (Computer013:String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : ComputerNotFound,PSSessionStateBroken
    How do I run commands inside the VM that is created from WAP in a Tenant cloud and use virtual network ?
    Regards
    Fredrik Ljus

    I get same error.
    Because I use Network Virtualization it looks like SMA or VMM cant find the VM.
    But how does it work if you for example make a gallery item that will install SQL.
    In that case the server will be installed from the original image with only the OS and then the SQL server will be installed after.
    How does the VMM/SPF communicate with the VM to install the SQL server? Bacause when installing the SQL server it mounts a VHD with the media and trigger the install localy on the VM.
    So, somehow it must be possible to communicate with the VM without using NAT and go through the Gateway server?

  • To run a report from command line, when using jdbc-odbc bridge

    Hi,
    How to run a report from command line, when using jdbc-odbc bridge?
    Usually with tns, we do by "rwrun module=<> userid=<user>/<passwd>@tns".
    with odbc, we do by "rwrun module=<> userid=<user>/<passwd>@odbc:DSN"
    Please specify, what is command line arguments for jdbc-odbc bridge driver?
    Environment : Oracle 9i Report Builder on WinNT
    Database : Sybase
    Regards,
    Ramanan

    Hello Ramanan,
    Report Builder : connect JDBC Query in Report Builder is to through Connection Dialog in JDBC Query Editor. User can use a Sign on parameter (can use, default : P_JDBCPDS or can create new) to connect to JDBC Data Source. Connection once made will be mentioned and will be reused through out Reports Builder.
    JDBC PDS allows user to connect one or more same or different kind of databases.
    While running report through runtime or Server, user can pass the sign on parameter(connection string) value, like any other user parameter.
    Syntax for connection string : <username>/<password>@databaseURL . The syntax of database part of connection string depend on the type of JDBC Driver used to connect to Data Source while designing the JDBC Query. databaseURL refer to the location of the database and its format depend on the JDBCPDS river selected in design time while creating the JDBC Query.
    rwrun eg :
    rwrun report=jdbc_odbc.rdf destype=file desname=output.html desformat=html P_JDBCPDS=scott/tiger@database
    Server eg :
    http://server.com:8888/servlet/RWServlet?server=MyReportServer+report=jdbc_odbc.rdf+destype=cache+desformat=html+P_JDBCPDS=scott/tiger@database
    http :
    Please see ORACLE_HOME/reports/conf/jdbcpds.conf for more information.
    With Regards
    Reports Team

  • Run Multiple SSIS Packages in parallel using SQL job

    Hi ,
    We have a File Watcher process to determine the load of some files in a particular location. If files are arrived then another package has to be kick-started.
    There are around 10 such File Watcher Processes to look for 10 different categories of files. All 10 File Watcher have to be started at the same time.
    Now these can be automated by creating 10 different SQL jobs which is a safer option. But if a different category file arrives then another job has to be created. Somehow I feel this is not the right approach.
    Another option is to create one more package and execute all the 10 file watcher packages as 10 different execute packages in parallel.
    But incase if they don’t execute in parallel, i.e., if any of the package waits for some resources, then it does not satisfy our functional requirement . I have to be 100% sure that all 10 are getting executed in parallel.
    NOTE: There are 8 logical processors in this server.
    (SELECT cpu_count FROM sys.dm_os_sys_info
    i.e., 10 tasks can run in parallel, but somehow I got a doubt that only 2 are running exactly in parallel and other tasks are waiting. So I just don’t want to try this  option.
    Can someone please help me in giving the better way to automate these 10 file watcher process in a single job.
    Thanks in advance,
    Raksha
    Raksha

    Hi Jim,
    For Each File Type there are separate packages which needs to be run.
    For example package-A, processes FileType-A and package-B processes FileType-B. All these are independent processes which run in parrallel as of now. 
    The current requirement is to have File Watcher process for each of these packages. So now FileWatcher-A polls for FileType-A and if any of the filetype-A is found it will kick start package-A. In the same way there is FileWatcher-B, which looks for FileType-B
    and starts Package-B when any of FileType-B is found. There are 10 such File Watcher processes.
    These File Watcher Processes are independent and needs to start daily at 7 AM and run for 3 hrs. 
    Please let me know if is possible to run multiple packages in parallel using SQL job.
    NOTE: Some how I find it as a risk, to run these packages in parallel using execute package task and call that master package in job. I feel only 2 packages are running in parallel and other packages are waiting for resources.
    Thanks,
    Raksha
    Raksha

  • Using computer variables in task sequence "Run Command Line"

    I am attempting to deploy VMs through VMware's vRealize Automation tool using CM. The process creates a CM computer object then creates a direct rule on a CM collection for the new computer object. During the creation of the computer object vRA creates computer
    variables provided by me on the computer object. I see the computer object built and i see the custom variables on the computer object:
    Name Value
    dns1 10.10.10.10
    dns2 10.10.10.11
    gateway 10.10.10.1
    ipAddress 10.10.10.2
    netMask 255.255.255.0
    In the task sequence the last step is to "Run Command Line":
    cmd /c netsh int ip set address name="Ethernet0" static %ipAddress% %netMask% %gateway% & cmd /c netsh int ip set dns name="Ethernet0" static %dns1% & cmd /c netsh int ip set dns name="Ethernet0" static %dns2% index=2
    When the TS gets to that step it doesn't substitute the variables in the command with the computer variables listed above. Looking at the smsts logs after the deployment is complete I see lines stating:
    Set Command Line:...
    Start executing command line:...
    Executing command line:...
    ProgramName = ...
    All of those lines show the command exactly as it is above with the %variables% intact.
    The command immediately fails with the error:
    Invalid address parameter (%ipAddress%). It should be a valid IPv4 address.
    Does anyone have a suggestion on why the TS isn't using the variables? I found this article https://technet.microsoft.com/en-us/library/bb693541.aspx but its for 2007 not 2012. I wasn't able to find something comparable for 2012.

    I don't know why anyone here thinks you *need* sccm osd to achieve fully automated customizations.
    Customer selects base image (2008 r2 core, 2008r2 gui, 2012 r2 core, 2012 r2 gui), which should be thin and with zero customizations anyway,
    vaai accelerated clone creates vm,
    ip addr/gateway/dns config is injected with powercli,
    customers config management engine agent of choice is installed via powercli script injection/execution (we have puppet users, ConfigMgr users, saltstack users, IEM users, Cheff users),
    the clone completes in ~2 minutes and a VM is presented to the customer in less than 5 minutes 
    Deploying windows VMs via SCCM OSD is not only slow, but requires dev work on the customer side to get things rolling which wastes everyone's cycles including your own

  • Run command without using ./

    Hi,
    Maybe I place this question in a wrong forum. But I guess there is somebody who knows.
    How to run command under Linus platform without using ./ ?
    For instance, I run ./crs_stat.
    How can I run crs_stat ?

    Hi,
    Thanks all.
    The values of the export,
    [oracle@css-rac1 ~]$ echo $ORA_CRS_HOME
    /u01/app/crs/product/11.1.0/crs
    [oracle@css-rac1 ~]$ echo $PATH
    /u01/app/crs/product/11.1.0/crs/bin:/u01/app/oracle/product/11.1.0/db_1/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/oracle/bin

  • Adpatch: Error running SQL and EXEC commands in parallel

    Hi
    I am applying R12 RUP2 to an instance at the moment. I had an OS crash (I'm running R12 on Linux on VMWARE) and on reboot attempted to restart the patch.
    I now get an error as follows:
    Error running SQL and EXEC commands in parallel
    I must admit, I'm not a DBA, so if anyone has any ideas or has seen this before then it would be most appreciated!
    Thanks
    Chris

    Hi Adith
    The patch is 5484000, RUP 2 for E-Business Suite R12
    Here's the adpatch output:
    Start date: Wed Sep 12 2007 15:15:14
    0 "left over" javaupdates.txt files uploaded to DB: Wed Sep 12 2007 15:15:14
    0 patches uploaded from the ADPSV format patch history files: Wed Sep 12 2007 15:15:14
    Uploading information about files copied during the previous runs ...
    0 "left over" filescopied_<session_id>.txt files uploaded to DB: Wed Sep 12 2007 15:15:14
    ****************** E N D O F U P L O A D ******************
    End date: Wed Sep 12 2007 15:15:14
    Already asked for the name of the patch directory.
    (The answer was: /oracle/patches/5484000)
    Already asked for the name of the patch driver file.
    (The answer was: /oracle/patches/5484000/u5484000.drv)
    Reading release list save file...
    Done reading release list save file
    Log and Info File sync point:
    Wed Sep 12 2007 15:15:15
    Turning off actions that reference unrecognized products.
    Log and Info File sync point:
    Wed Sep 12 2007 15:15:15
    End of unrecognized products checking.
    (The number of parallel workers is: " 2 ")
    AutoPatch will run in parallel mode.
    Did not need to apply new applterr.txt.
    Skipping...
    Determine directories to create for Specified driver
    since no such action is present for this driver file
    Skipping...
    Determine Oracle Reports libraries to generate for Specified driver
    since no such action is present for this driver file
    Skipping...
    Determine if need to generate message files for Specified driver
    since no such action is present for this driver file
    Skipping...
    Create Directories for Specified driver
    since no such action is present for this driver file
    Number of invalid objects: 31057
    Running SQL scripts and EXEC commands...
    Determining which SQL and EXEC commands to run...
    Validating PL/SQL direct execute exceptions file ...
    Done validating PL/SQL direct execute exceptions file.
    SERVICE_NAME/INSTANCE_NAME : [VIS]
    connect_string : [(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ebusr12.chriseebee.me.uk)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=VIS)))]
    Done determining which SQL and EXEC commands to run.
    Running SQL and EXEC commands in parallel...
    Creating the AD_UTIL_PARAMS table...
    Table AD_UTIL_PARAMS already exists, so dropping the table and recreating it.
    Creating FND_INSTALL_PROCESSES table...
    Already created fnd_install_processes table
    Already created FND_INSTALL_PROCESSES_U1 index.
    Already created AD_DEFERRED_JOBS table
    Already created AD_DEFERRED_JOBS_U1 index.
    Writing dependencies of jobs to run to appldep.txt file...
    There are now 7569 jobs remaining (current phase=A0):
    0 running, 5 ready to run and 7564 waiting.
    Reading completed jobs from restart file (if any).
    There are now 3474 jobs remaining (current phase=A18):
    0 running, 1 ready to run and 3473 waiting.
    Determining which java executables are supported by adJavaWorker...
    Starting worker processes.
    Worker process 1 started.
    Worker process 2 started.
    Checking if all jobs have their actual and symbolic arguments in sync....
    Done.
    Writing jobs to run to restart file.
    Reading jobs from FND_INSTALL_PROCESSES table ...
    Running: file adobjcmp.sql on worker 1 for product ad username APPLSYS.
    AutoPatch error:
    The worker should not have status 'Running' or 'Restarted' at this point.
    Telling workers to quit...
    ************* Start of AD Worker session *************
    AD Worker version: 12.0.0
    AD Worker started at: Wed Sep 12 2007 15:15:34
    APPL_TOP is set to /oracle/VIS/apps/apps_st/appl
    ************* Start of AD Worker session *************
    AD Worker version: 12.0.0
    AD Worker started at: Wed Sep 12 2007 15:15:34
    APPL_TOP is set to /oracle/VIS/apps/apps_st/appl
    All workers have quit.
    AutoPatch error:
    Error running SQL and EXEC commands in parallel
    You should check the file
    /oracle/VIS/apps/apps_st/appl/admin/VIS/log/adpatch.log
    for errors.

  • Error running SQL and EXEC commands in parallel when adpatch

    Hi,
    AutoPatch error:
    aiprfp: product 'cle' not in release 'R120'
    AutoPatch error:
    Error running SQL and EXEC commands in parallel
    Freeing includes hash table
    Freeing fixes hash table
    Freeing basedons hash table
    Freeing entities hash table
    You should check the file
    /a02/prod/apps/apps_st/appl/admin/PROD/log/adpatch_7305220_1.log
    for errors.
    How to resolve this errror while applying patch 7305220.
    Regards,

    Hi,
    Please check logfile */a02/prod/apps/apps_st/appl/admin/PROD/log/adpatch_7305220_1.log* for any errors recoded.
    Post error messages from this logfile.This is the main patch log file and it should show the same error "aiprfp: product 'cle' not in release 'R120'".
    Thanks,
    Hussein

  • How to using sqlplus to connect and run command ?

    Hello,i have a small problem please help me
    I want to use sqlplus to connect and run command
    for example : sqlplus test/test@DB select sysdate from dual ;
    and then it will show data (sysdate) to screen
    what should i do ?
    Thanks

    kenshin19xx wrote:
    Hello,i have a small problem please help me
    I want to use sqlplus to connect and run command
    for example : sqlplus test/test@DB select sysdate from dual ;
    and then it will show data (sysdate) to screen
    what should i do ?
    Thanks
    bcm@bcm-laptop:~$ echo "select sysdate from dual ;" > now.sql
    bcm@bcm-laptop:~$ sqlplus user1/user1 @now
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 14 20:41:33 2011
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SYSDATE
    2011-12-14 20:41:33

  • Using DB to run command locally.

    Is there a way toolset to run a local command on db.
    I currently use a host command via our software to copy some files from one area of the db server to another. But would rather this be done via the database.
    ITs a simple run command
    CMD /c MOVE /Y c:\install\*.* c:\

    http://lmgtfy.com/?q=oracle+pl%2Fsql+os+command

  • Running commands on VMs remotely

    Hi Everyone
    New to all of this so please bear with me!
    Starting a new project and looking to compare between the use of Hyper V and ESXi.  
    The project is to grab vms regardless of state, turn them on and execute scripts stored on a vm drive. The script execution has to be performed / issued by a user. C# is the main underlying code but we can potentially put in references to use powershell
    scripts / whatever else if we can achieve this using hyper v.
    I know from doing a bit of reading on ESXi that we can do this using a number of ways - vmrun to start, stop and run commands on the actual vm itself. using other vmware libraries and APIs.
    I have read that powershell commands include starting vms, taking snapshots, shutting down vms but I was wondering if we can get into the actual VM remotely / somehow in-order to, for example, run a script which is stored on that VMs C drive.
    Has anyone tried this / is it do-able? -  I have had no luck finding any examples of what we need. 
    Kind Regards,
    Ashley

    I have a few things that I have done historically.
    Really, you have two options.  a WMI (API) call or a WinRM / PowerShell remoting call.
    The difference between the two is 1) security settings and 2) ease of use.
    For WinRM the security needs to be more open then WMI.  But, it is far easier to script as you simply open a remote session and you keep scripting along in the remote shell (the tricky part is pulling values back to the local session).  With WMI
    you always get the values back since you never spawn into another session.
    Below is a WinRM example of using WinRM and returning some value back:
    It executes a WMI command on the remote machine to fin the file I am looking for (as that is faster) and then I read the file with the script.
    # This block of script executes remotely and returns the content of hte CtxSta.config file.>
    $sta = invoke-command -Session $s -ScriptBlock {
    $staArray = get-wmiobject CIM_DataFile -filter 'Extension="config" and FileName="CtxSta"'
    # If IIS Integration is installed there could be multiples, this is the one that CSG is hard coded to use.
    foreach ($e in $staArray) {
    if ($e.Path -match "citrix\\system32") {
    $sta = $e
    get-content -path ([string]$sta.Name)
    # We have returned to local execution.
    foreach ($e in $sta) {
    switch -wildcard ($e) {
    "UID*" {
    $e = $e -replace "UID", ""
    $e = $e -replace "=", ""
    $e = $e -replace " ", ""
    $staId = $e
    $staId
    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

  • URGENT-How to run command in java application???

    URGENT!
    i would like to run command to invoke some applications (like invoke application using command line in DOS) in my java appication.
    Do anyone know how to do this? Thanks a lot.

    This question has been asked upteen times.
    ok the code is
    for win95
    Runtime.getRuntime().exec( "start c:\\tmp.txt" );
    for win 2000
    Runtime.getRuntime().exec( "cmd /C startc:\\tmp.txt" );
    //change the file to your desire file..
    i am not so sure about win98, sorry...

  • Error while running commands at RMAN prompt

    Hi ,
    We have a few oracle 10g(10.2.0.3) databases on AIX platform.We use RMAN backup with a recovery catalog database.
    The rman full(level 0)backups are scheduled dailly and running fine.When I tried to run commands like 'list backup','report obsolete' I'm getting the following errors.
    connected to target database: TICSPROD (DBID=2626621498)
    connected to recovery catalog database
    RMAN> report obsolete;
    RMAN retention policy will be applied to the command
    RMAN retention policy is set to redundancy 3
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of report command at 08/04/2011 07:49:36
    RMAN-06004: ORACLE error from recovery catalog database: ORA-03113: end-of-file on communication channel
    ORACLE error from recovery catalog database: ORA-03114: not connected to ORACLE
    RMAN> list backup;
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of list command at 08/04/2011 07:56:25
    RMAN-06004: ORACLE error from recovery catalog database: ORA-03113: end-of-file on communication channel
    ORACLE error from recovery catalog database: ORA-03114: not connected to ORACLE
    But the recovery catalog database is up and running fine.For few other databases I'm able to run the above commands without errors and for some databases I'm getting the errors as mentioned above.
    Could someone help me out with this...

    Thanks Tycho for your reply.
    Please find the output of the query in recovery catalog.
    SQL> select * from v$resource_limit;
    RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL LIMIT_VALU
    processes 49 83 5000 5000
    sessions 30 63 5505 5505
    enqueue_locks 27 94 65910 65910
    enqueue_resources 27 73 24440 UNLIMITED
    ges_procs 0 0 0 0
    ges_ress 0 0 0 UNLIMITED
    ges_locks 0 0 0 UNLIMITED
    ges_cache_ress 0 0 0 UNLIMITED
    ges_reg_msgs 0 0 0 UNLIMITED
    ges_big_msgs 0 0 0 UNLIMITED
    ges_rsv_msgs 0 0 0 0
    gcs_resources 0 0 0 0
    gcs_shadows 0 0 0 0
    dml_locks 0 76 24220 UNLIMITED
    temporary_table_locks 0 3 UNLIMITED UNLIMITED
    transactions 1 10 6055 UNLIMITED
    branches 0 0 6055 UNLIMITED
    cmtcallbk 0 1 6055 UNLIMITED
    sort_segment_locks 0 5 UNLIMITED UNLIMITED
    max_rollback_segments 11 11 6055 65535
    max_shared_servers 20 20 800 800
    parallel_max_servers 0 32 320 3600
    22 rows selected.
    The alert log of the catalog database is continously getting refreshed with the following message.
    Incremental checkpoint up to RBA [0x3b3.a780.0], current log tail at RBA [0x3b3.a78f.0]
    Mon Aug 8 00:16:17 2011
    Incremental checkpoint up to RBA [0x3b3.abf8.0], current log tail at RBA [0x3b3.ac4f.0]
    Mon Aug 8 00:46:19 2011
    Incremental checkpoint up to RBA [0x3b3.1451b.0], current log tail at RBA [0x3b3.1451b.0]
    Mon Aug 8 01:16:21 2011
    Incremental checkpoint up to RBA [0x3b3.14b15.0], current log tail at RBA [0x3b3.14baa.0]
    Mon Aug 8 01:46:23 2011
    Incremental checkpoint up to RBA [0x3b3.14be1.0], current log tail at RBA [0x3b3.14bf0.0]
    Mon Aug 8 02:16:25 2011
    Incremental checkpoint up to RBA [0x3b3.15069.0], current log tail at RBA [0x3b3.150a9.0]
    Mon Aug 8 02:46:27 2011
    Incremental checkpoint up to RBA [0x3b3.150ed.0], current log tail at RBA [0x3b3.150ed.0]
    What could be the potential cause of the issue I'm facing .Could you please guide me...

  • Requirement wherein I want to call two queries in parallel using ABAP Prg

    We are using RSCRM_BAPI to run a query in background and write the results to a table. We later read this table and create a file. I have a requirement u2013 wherein I want to call two queries in parallel using an ABAP program.
    For our discussion assume:
    1) Program : ZCALL_RCRMBAPI  is a program that calls RSCRM_BAPI in background and takes the query name as input
    2) Program: ZMAIN_PROGRAM  this is the main program
    The requirement is to call the ZCALL_RCRMBAPI in a loop. Also within the loop call it in parallel. Basically we have an ODS that stores ; FISCPER. So I call the two queries for a list of FISCPER.
    ZMAIN_PROGRAM - A program that reads a table (ODS ) in our case and call the two programs in a loop and both should run in parallel .
    Now if it was sequential u2013 it was easy u2013 I would just say
    Loop at L_T_FISCPER .
    Update Z_FISCPER with L_T_FISCPER-FISCPER u201C Assume Z_FISCPER is a Z table . The VARIABLE in the query Q1 and Q2 use a customer exit to read this table.
    A)       SUBMIT ZCALL_RCRMBAPI with P_QUERy = Q1 and return .
    B)      SUBMIT ZCALL_RCRMBAPI with P_QUERy = Q2 and return .
    Endloop .
    Question: How do I make these calls in parallel u2013 yet retain control in the main program?
    A)       SUBMIT ZCALL_RCRMBAPI with P_QUERy = Q1 and return .
    B)      SUBMIT ZCALL_RCRMBAPI with P_QUERy = Q2 and return .

    Instead of RSCRM BAPI you can use the RRW3_QUERY_VIEW_DATA function module for greater control over program execution...
    /people/arun.varadarajan/blog/2009/07/29/make-the-most-out-of-query-execution--part-1
    will give you pointers as to how this can be done...

Maybe you are looking for

  • How to create a new channel for a role or an organization using API

    Hi all, I tryed to create a new channel using the method createChannel(...)+ in the class ContainerProviderContext+ of the package com.sun.portal.providers.context+ and everything is fine. The channel is created under the display profile of the authe

  • Can't upgrade Mainstage 2.0.1 to 2.1

    Hello, I've tried to upgrade Mainstage 2.0.1 to 2.1 but each time I do I get a message that its not necessary for my computer. But, Version# is still 2.0.1 Logic Pro upgraded to 9.1.0 no problem. Whats up? Thanks for any help! Running on: MacBook Pro

  • Tomcat recompiling servlets

    While I am still making changes to a servlet code, how can I make a servlet reload every time I test it? Mani

  • Mountain Lion download problem

    I have been trying to download Mountain Lion for about 5 hours now and I keep getting errors saying the download cannot be completed. The last error I recieved was The download could not be completed becasue of a Hash Mismatch Error. A download of ab

  • Convert labview 10 to labview 9

    Please convert from labview 10 to labview 9 Thanks Solved! Go to Solution. Attachments: Error Processor.vi ‏21 KB Error Options.ctl ‏6 KB Error prompt.vi ‏52 KB