C# Run VB Script file remotely thriugh PowerShell Invoke Command

I have a requirement where need to run vbscript remotely through PowerShell Invoke command. I can run the VB Script locally but not remotely as the vbscript file is not present on the remote machine. I don't want to copy the script file on remote machine.
Please let me know how to run vb script on remote machine. Below is the code.
Collection<PSObject> output
= null;
        using
(Runspace runSpace =
RunspaceFactory.CreateRunspace())
            runSpace.Open();
            using
(Pipeline pipeline = runSpace.CreatePipeline())
RunspaceInvoke invoke =
new RunspaceInvoke();
PowerShell ps = PowerShell.Create();
                ps.Runspace
= runSpace;
                ps.AddCommand("invoke-command");
                ps.AddParameter("ComputerName",
"RemoteServerName");
ScriptBlock sb = ScriptBlock.Create("cscript E:\\Test\\DeleteFiles.vbs");
                ps.AddParameter("ScriptBlock", sb);
                output
= ps.Invoke();
Regards, Parveen

Hello Parveen,
Please refer to the following thread
https://social.msdn.microsoft.com/Forums/vstudio/en-US/7562eefb-7fba-4bf6-834e-82256f159155/run-script-on-remote-macine?forum=csharpgeneral
See his code:
You can use WMI to create processes on a remote machine. In C#, use the ManagementClass.
using System;
using System.Management;
using System.Collections.Generic;
public class MyClass
public static void RunNotepad()
ManagementPath p = new ManagementPath(@"\\targetMachine\root\cimv2:Win32_process");
ManagementClass m = new ManagementClass(p);
m.InvokeMethod("Create", new Object[] {"notepad.exe"});
See: Creating Processes Remotely
Note that the the scrpt file is not executable so you have to create script like this:
 cscript.exe "\\yourmachine\script\test.vbs".
Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Remote Exchange Powershell invoke command - customize return result

    Hi
    I am trying to create a powershell which connects to an exchange management shell and executes a command.
    [scriptblock]$Command = {Get-MailboxDatabaseCopyStatus | select Name,ContentIndexState}
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://$Computername/powershell -Credential $Cred
    Import-PSSession $Session
    $Returnvalue = $Command.Invoke()
    Remove-PSSession $Session
    This would return a result like this:
    Name : DB02 - Specielle\EXCHANGE01
    ContentIndexState : Healthy
    Name : DB01 - Standard\EXCHANGE01
    ContentIndexState : Healthy
    Now how do I create an if-sentence that would check if both are "Healthy" and then return "Echo "Healthy"", else if one is not healthy then return "Echo "Not Healthy""? (I dont need to specify which one that
    isn't healthy).
    Best Regards,
    Soren

    Hi Soren,
    Give this a try (untested, sorry):
    [scriptblock]$Command = {
    $healthy = $true
    $statusList = Get-MailboxDatabaseCopyStatus
    foreach ($status in $statusList) {
    If ($status.ContentIndexState -ne 'Healthy2') { $healthy = $false }
    If ($healthy) { Write-Output 'Healthy' }
    Else { Write-Output 'Not Healthy' }
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • Reg: How to Run a Script File in WebLogic Server 10.3.3

    Hi WebLogic Experts,
    In our project we are using WebLogic Serve 10.3.3. I need to run one script file. could you please suggest me where should i need to place that script file in WebLogic Server 10.3.3 and How to run & stop that Script file.?
    please experts i waiting for your's reply..
    Thanks & Regards,
    Induja..

    1. You can put a command line into startWebLogic.sh to start your script file.
    2. In your proyect you can create a java class to run the script file.
    3. You can create a java class to run the script file an setup it like a startup class into weblogic server.
    4. You can create a java class to run the script file an setup it like a job scheduler into weblogic server.
    In what time you need run this script file?

  • How can you run a command with elevated rights on a remote server with invoke-command ?

    I am trying to run a script on a remote server with invoke-command.  The script is starting and is running fine, but the problem is that it should be running with elevated rights on the remote server.  On the server where I start the invoke-command, my account has the necessary rights.
    The server were I launch the invoke-command is a W2K8 R2.  The remote box is a W2K3 with powershell v2.0 installed.
    When I launch the script on the remote-box from the command line, I don't get the access denied's.
    Is there a way to do this ?
    Thanks in advance

    The script that I want to run is to install the windows updates.  I get an access denied on the download of the updates.
    When I execute the script on an W2K8 box, (not remotely) and I run it with non-elevated rights, I get the same error.
    The script is running fine when it is launched on W2K3 box locally with a domain account that has local admin rights, or on a W2K8 R2 server with a domain account that has local admin rights, but with elevated rights.
    Thanks in advance for your help.
    #=== start script ====
    param($installOption="TESTINSTALL",$rebootOption="NOREBOOT")
    Function Show-Help
    Write-Host ""
    Write-Host "SCRIPT: $scriptName <installOption> <RebootOption>"
    Write-Host ""
    Write-Host "DESCRIPTION: Installatie van WSUS updates op de lokale server"
    Write-Host ""
    Write-Host "PARAMETERS"
    Write-Host " -installOption <[INSTALL|TESTINSTALL]>"
    Write-Host " -rebootOption <[REBOOT|NOREBOOT|REBOOT_IF_UPDATED]>"
    Write-Host ""
    Write-Host "EXAMPLE:"
    Write-Host "$ScriptName -installOption INSTALL -rebootOption REBOOT_IF_UPDATED"
    Write-Host "$ScriptNAme INSTALL NOREBOOT"
    Write-Host ""
    Write-Host "Indien beide parameter weggelaten worden zijn de defaultwaarden :"
    Write-Host " installOption=TESTINSTALL "
    Write-Host " RebootOption=NOREBOOT"
    Write-Host ""
    Exit
    #Include alle globale variablen
    $CEIF_WIN_PATH = (get-content env:CEIF_WIN_PATH)
    $includeFile=$CEIF_WIN_PATH + "\Scripts\include_win.ps1"
    . $includeFile
    #initialiseer error count
    $errcnt=0
    $scriptName=$MyInvocation.MyCommand.Name
    #argumenten controleren
    $arrInstallOption= "TESTINSTALL", "INSTALL" # Mandatory variable with predefined values
    If (!($arrInstallOption –contains $installOption)){ Show-Help }
    $arrRebootOption = "REBOOT", "NOREBOOT","REBOOT_IF_UPDATED" # Mandatory variable with predefined values
    If (!($arrRebootOption –contains $rebootOption)){ Show-Help }
    #Logfile opbouwen
    $logfile = get-logfileName($MyInvocation.MyCommand.Name)
    Log-scriptStart $MyInvocation.MyCommand.Name $logfile
    function Get-WIAStatusValue($value)
    switch -exact ($value)
    0 {"NotStarted"}
    1 {"InProgress"}
    2 {"Succeeded"}
    3 {"SucceededWithErrors"}
    4 {"Failed"}
    5 {"Aborted"}
    function boot-server()
    if ($installOption -eq "TESTINSTALL")
    logger "TESTINSTALL : - Reboot local Server" $logfile
    else
    logger " - Reboot local Server" $logfile
    $thisServer = gwmi win32_operatingsystem
    $thisServer.psbase.Scope.Options.EnablePrivileges = $true
    $thisServer.Reboot()
    $logmsg="Install option = " + $installOption + ", RebootOption = $rebootOption"
    logger "$logmsg" $logfile
    logger "" $logfile
    logger " - Creating WU COM object" $logfile
    $UpdateSession = New-Object -ComObject Microsoft.Update.Session
    $UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
    logger " - Searching for Updates" $logfile
    $SearchResult = $UpdateSearcher.Search("IsAssigned=1 and IsHidden=0 and IsInstalled=0")
    logger " - Found [$($SearchResult.Updates.count)] Updates to Download and install" $logfile
    $Updates=$($SearchResult.Updates.count)
    logger "" $logfile
    foreach($Update in $SearchResult.Updates)
    if ($Update.EulaAccepted -eq 0)
    $Update.AcceptEula()
    # Add Update to Collection
    $UpdatesCollection = New-Object -ComObject Microsoft.Update.UpdateColl
    $UpdatesCollection.Add($Update) | out-null
    if ($installOption -eq "TESTINSTALL")
    else
    # Download
    logger " + Downloading Update $($Update.Title)" $logfile
    $UpdatesDownloader = $UpdateSession.CreateUpdateDownloader()
    $UpdatesDownloader.Updates = $UpdatesCollection
    $DownloadResult = $UpdatesDownloader.Download()
    $Message = " - Download {0}" -f (Get-WIAStatusValue $DownloadResult.ResultCode)
    if ($DownloadResult.ResultCode -eq 4 )
    { $errcnt = 1 }
    logger $message $logfile
    # Install
    logger " - Installing Update" $logfile
    $UpdatesInstaller = $UpdateSession.CreateUpdateInstaller()
    $UpdatesInstaller.Updates = $UpdatesCollection
    $InstallResult = $UpdatesInstaller.Install()
    $Message = " - Install {0}" -f (Get-WIAStatusValue $InstallResult.ResultCode)
    if ($InstallResult.ResultCode -eq 4 )
    { $errcnt = 1 }
    logger $message $logfile
    logger "" $logfile
    #Indien er een fout gebeurde tijdens download/installatie -> stuur mail naar windowsteam
    if ( $errcnt -gt 0 )
    logger " - Fout tijdens de uitvoering van script -> send mail" $logfile
    $mailSubject=$MyInvocation.MyCommand.Name
    $msg = new-object Net.Mail.MailMessage
    $att = new-object Net.Mail.Attachment($logfile)
    $smtp = new-object Net.Mail.SmtpClient($smtpServer)
    $msg.From = $mailFrom
    $msg.To.Add($mailTo)
    $msg.Subject = $mailSubject
    $msg.Body = “Meer details in attachement”
    $msg.Attachments.Add($att)
    $smtp.Send($msg)
    #Moet de server herstart worden ?
    if ($rebootOption -eq "REBOOT_IF_UPDATED" )
    if ($Updates -gt 0)
    #Reboot the server when updates are installed
    boot-server
    elseif ($rebootOption -eq "REBOOT")
    #reboot the server always
    boot-server
    else
    #Do not reboot the server
    logger "Do not reboot the server" $logfile
    Log-scriptEnd $MyInvocation.MyCommand.Name $logfile
    exit 0

  • Running sql script files to re create database

    We have having around 10 sql script file that has sql statments inside it (example insert .... delete...update.... etc).Right now what we do is that in jdbc we open each script file, and read each line ,and then make jdbc call run jdbc for each sql statement inside the file.
    Wondering if there is a better way to do this.
    Right now the challenges are
    1)The process goes wrong if there is an extra semi colon ...or extra space after a statments...etc...Basically I find this way of creating data odd...
    2)it is slow because of the network traffic between application server and database server for every sql statements that gets executed.The solution for this issue is to do a batch update....But still I dont like this solution.
    Can someone give me any better idea.
    I am thinking to have all this sql script moved to a store procedure (rather than inside the sql script file) .JDBC then can pick this store procedure sql file ,and create this store procedure via jdbc, and then execute this store procedure.
    This will be faster because all the sql will be running in the databsase.Only one trip to database to call this store procedure.
    Is this a good idea ?
    thx
    m

    Manjit wrote:
    We have having around 10 sql script file that has sql statments inside it (example insert .... delete...update.... etc).Right now what we do is that in jdbc we open each script file, and read each line ,and then make jdbc call run jdbc for each sql statement inside the file.
    Wondering if there is a better way to do this.
    Right now the challenges are
    1)The process goes wrong if there is an extra semi colon ...or extra space after a statments...etc...Basically I find this way of creating data odd...
    2)it is slow because of the network traffic between application server and database server for every sql statements that gets executed.The solution for this issue is to do a batch update....But still I dont like this solution.
    Can someone give me any better idea.
    I am thinking to have all this sql script moved to a store procedure (rather than inside the sql script file) .JDBC then can pick this store procedure sql file ,and create this store procedure via jdbc, and then execute this store procedure.
    This will be faster because all the sql will be running in the databsase.Only one trip to database to call this store procedure.
    Is this a good idea ?
    thx
    mI'm not 100% sure i follow (it's Friday and i have a mild case of ADD).
    Are you suggesting having the Java application create procedures in the database on the fly? If so i would say that's not a good idea.
    Create the stored procedures in the database, have Java call them as needed to process data.
    If you need to load copious amounts of data, look in to external tables, it's possible they could come in handy for what you are doing .... or not ... again, it's hard to say given i find your description of what's currently happening somewhat confusing.

  • Logic to run Unix script file through ABAP program

    Hi Friends,
    I need to run the Unix script file from abap program, for that user provided file directory of application server.
    Is there any logic/FM  to run through abap programing.
    pls can any one provide logic.
    Thanks,
    Ravi

    report zsrchsap.
    *-This is a demo report for Search Sap
    *-Author : Sandeep Kulkarni
    *-Date : 09/20/2001
    parameters : p_sfile(60) lower case
              "File to be moved
              "Eg : /home/in/SFILE1.txt
                p_dfile(60) lower case.
              "File's Destination
              "Eg: /home/archive/SFILE1.txt
    data : t_btcxpm
           like btcxpm occurs 0,
           p_addparam
           like sxpgcolist-parameters.
      concatenate
      '/home/ABAP/scripts/Archive_file.sh'
      p_sfile
      p_dfile
      into p_addparam separated by space.
      refresh t_btcxpm. clear t_btcxpm.
      call function 'SXPG_CALL_SYSTEM'
        exporting
          commandname = 'ZSHELL'
          additional_parameters = p_addparam
        tables
          exec_protocol = t_btcxpm
        exceptions
          no_permission              = 1
          command_not_found          = 2
          parameters_too_long        = 3
          security_risk              = 4
          wrong_check_call_interface = 5
          program_start_error        = 6
          program_termination_error  = 7
          x_error                    = 8
          parameter_expected         = 9
          too_many_parameters        = 10
          illegal_command            = 11
          others                     = 12.
      if sy-subrc = 0.
        write : /
        'File',p_sfile,'moved to',p_dfile.
      else.
        write : / 'Error Occured'.
      endif.

  • Run perl script on remote server

    Hello
    I have 2 servers, server 1 and server2.
    I have a perl script on server2 and I want to execute that perl script so my code is like
    $command= { param($p1,$p2) cmd /c test.pl $p1 $p2 }
    Invoke-Command -session $sesion -ScriptBlock $command -ArgumentList 1,2
    session is already created with server2 from server1. 
    perl script kept on server2 spawn another cmd which interacts with server3.
    When I run above code that perl script start executing but it stays in executing step for infinite time..as per observation, I have found that it stucks when it tried to spawn another cmd which interacts with server3 from server2.
    How can I handle this?

    Second hop restriction and some issue in the perl script that prevents it from honoring the error.
    Run script interactively to test results.
    Enter-PsSession $session
    Type your command and see if you see an error.
    \_(ツ)_/

  • Suppress file deletion confirmation on remote server in Invoke-Command

    Hi!
    I try create function used for removing folders (and all content) on remote servers .
    $FullPathToDelete="\\"+("$Computername\$BasePath\$FolderToDelete").Replace("\\","\")
    if (Test-Path $FullPathToDelete -pathType container ) {
    $ScriptBlockContent = {
    paramater($FullPathToDeleteLocal)
    Get-ChildItem -Path $FullPathToDeleteLocal -Recurse | Remove-Item -Force $true -Recurse $true -Confirm:$false | Out-Null
    Invoke-Command -Computername $Computername -ScriptBlock $ScriptBlockContent -ArgumentList $FullPathToDelete -AsJob
    Remove-Item -Path $FullPathToDelete -Force | Out-Null
    Example values for variables
    $Computername = "SPPL09281"$BasePath="D$"$FolderToDelete="FolderName"
    All work but for every computer (I use this code in a loop) I receive additional prompt for confirmation
    Id Name State HasMoreData Location Command
    11 Job11 Running True SPPL09281 ...Confirm
    The item at Microsoft.PowerShell.Core\FileSystem::\\SPPL09281\D$\FolderName has children and the Recurse
    parameter was not specified. If you continue, all children will be removed with the item. Are you sure you want to
    continue?
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
    How I can avoid these confirmation prompts?
    Thank you in advance.
    Wojciech Sciesinski

    Hi Wojciech,
    In addition, The original confirm is reminding the folder you want to delete has subfiles, please try to add -recurse parameter:
    $FullPathToDelete="\\"+("$Computername\$BasePath\$FolderToDelete").Replace("\\","\")
    if (Test-Path $FullPathToDelete -pathType container ) {
     $ScriptBlockContent = {
      paramater($FullPathToDeleteLocal)
      Get-ChildItem -Path $FullPathToDeleteLocal -Recurse | Remove-Item -Force -Recurse -Confirm:$false | Out-Null
     Invoke-Command -Computername $Computername -ScriptBlock $ScriptBlockContent -ArgumentList $FullPathToDelete -AsJob
     Remove-Item -Path $FullPathToDelete -Recurse -Force
    If there is anything else regarding this issue, please feel free to post back.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support

  • Powershell - Invoke-Command Network Connection has been interrupted

    Hi,
    I have been having this problem intermittently, i use
    invoke-command -AsJob -computername myserver1 -scriptblock {get-process}
    WARNING: The network connection to myserver1 has been interrupted. Attempting to reconnect for up
    to 4 minutes...
    WARNING: Attempting to reconnect to myserver1 ...
    WARNING: The network connection to myserver1 has
    been restored.
    On another window i did a ping myserver1 -t to see if any network packets are lost but anything of that sort happened.
    I tried using the IP of myserver1 as well and see the same.
    Any idea why this message comes up and under what circumstances?
    Thanks for your thoughts and help.

    Hi Past,
    this sounds like a temporary lack of access to the necessary remote resources. Direct network connectivity is of course mandatory, but there are more dependencies. Pinging will still work when the WinRM service hangs, local Powershell Execution on the target
    is on hold, massive lack of available resources, etc..
    I do not know of any specifically typical reasons for this to occur, so the only recommendation I can give you is to do some more in depth monitoring on the target device while recreating the issue.
    Cheers,
    Fred
    There's no place like 127.0.0.1

  • Hot to run "Deploy WSP" file through sharepoint Powershell from C# win Application

    HI All,
         I have create one web part (wsp) and also i have created one window application for deploy wsp file through powershell commands but i am stuck in executing the commands from powershell from c# win app .please let me know any have idea about
    this  ?
    Software developer

    Hi,
    The following code snippet for your reference:
    public string RunPowershell(string powershellText, SPWeb web, string param1, string param2)
    // Powershell ~= RunspaceFactory - i.e. Create a powershell context
    var runspace = RunspaceFactory.CreateRunspace();
    var resultString = new StringBuilder();
    try
    // load the SharePoint snapin - Note: you cannot do this in the script itself (i.e. add-pssnapin etc does not work)
    PSSnapInException snapInError;
    runspace.RunspaceConfiguration.AddPSSnapIn("Microsoft.SharePoint.PowerShell", out snapInError);
    runspace.Open();
    // set a web variable.
    runspace.SessionStateProxy.SetVariable("webContext", web);
    // and some user defined parameters
    runspace.SessionStateProxy.SetVariable("param1", param1);
    runspace.SessionStateProxy.SetVariable("param2", param2);
    var pipeline = runspace.CreatePipeline();
    pipeline.Commands.AddScript(powershellText);
    //add a "return" variable
    pipeline.Commands.Add("Out-String");
    var results = pipeline.Invoke();
    //convert the script result into a single string
    foreach (PSObject obj in results)
    resultString.AppendLine(obj.ToString());
    finally
    // close the runspace
    runspace.Close();
    // consider logging the result. Or something.
    return resultString.ToString();
    More information:
    Running Powershell from within SharePoint
    http://geekswithblogs.net/Norgean/archive/2012/09/19/running-powershell-from-within-sharepoint.aspx
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Running MySQL script on remote computer.

    Is there any way to run a MySQL script located on a local machine on another computer located on the same network given that you already know the ip address, port number, MySQL username and password, and the database name. I am investigating trying to send the file across the network, but have not found a solution that works.

    Sure, provided you have set up a server to accept those scripts and run them. In general you can't just run executable code on somebody else's computer without having a server and permissions set up in advance; I'm sure you can see why if you think of the word "security".

  • How to run SQL script file on Linux using Java ?

    Hi,
    I need to execute .sql file using java. I used following approach for this.
    private void runScriptEvent(java.awt.event.ActionEvent evt) {                               
            String sqlOutput = "";
            String sqlPromptLines="";
            String currentFunctionName = "";
            if(con!=null){
                String userName = jTextField4.getText();
                String password = jPasswordField1.getText();
                String databaseName = jTextField3.getText();
                try {
                    String script_location = "";
                    ProcessBuilder processBuilder =null;
                    Process process = null;
                    //File file = new File("C:/ScriptFile");
                    File file = new File("./SQL_Script");
                    //File file = new File("E:\\install\\SQL_Script");
                    if(file.exists()){
                        File [] list_files= file.listFiles(new FileFilter() {
                                        public boolean accept(File f) {
                                        if (f.getName().toLowerCase().endsWith(".sql"))
                                        return true;
                                        return false;
                    int count = 0;
                        for (int i = 0; i<list_files.length;i++){
                            script_location = "@" + list_files.getAbsolutePath();//ORACLE
    //currentFunctionName = list_files[i].getName();
    StringTokenizer st = new StringTokenizer(list_files[i].getName(), ".");
    while(st.hasMoreTokens()) {
    currentFunctionName = st.nextToken();
    String extention= st.nextToken();
    System.out.println("Function Name = "+currentFunctionName + "\t Extention = " + extention);
    processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLE
    processBuilder.redirectErrorStream(true);
    process = processBuilder.start();
    BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
    String currentLine = null;
    while ((currentLine = in.readLine()) != null) {
    sqlPromptLines = " "+sqlPromptLines + currentLine +"\n";
    count ++;
    System.out.println(count+" " + currentLine);
    if(currentLine.equalsIgnoreCase("Function created.")){
    sqlOutput = "\n" sqlOutput currentFunctionName + " " currentLine"\n" ;
    break;
    }// end while
    in.close();
    process.destroy();
    }//end for
    }//end if file exists
    } catch (IOException e1) {
    jTextArea1.setText(e1.getMessage());
    System.out.println("Script Done");
    jTextArea1.append(sqlOutput);
    }// end id Connection is not null
    Above code working appropriate on Windows but not on Linux.
    is there any changes needed ?
    Regards,
    Ajay
    Edited by: Ajay Sharma on Nov 21, 2012 6:43 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi gimbal2,
    about code
    jTextArea1.setText(e1.getMessage());I am using this code so that the user will be prompted with a message rather than stack trace.
    About the issue I am getting on linux i believe its because of following statement.
    processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLERegards,
    Ajay
    Edited by: Ajay Sharma on Nov 23, 2012 12:05 PM
    Edited by: Ajay Sharma on Nov 23, 2012 12:06 PM

  • How to run .cmd file from a Powershell script

    Hi,
    I would like to know how I run commands from a powershell script? how to use the invoke-command?
    This powershell script doesnt work for me
    Invoke-Command C:\setup.cmd -ArgumentList install-setupforced

    To run a batch file from powershell, just type its name with arguments. I'd recommend explicitly including the .CMD file type and, if it is located in the current folder, powershell rules require you to explicitly say so, i.e.:
       ./mybatch.cmd inputfile.txt outputfile.txt
    To run a single cmd.exe command, just prefix it with cmd.exe /c as Mike says:
        cmd.exe /c color 48
    to run a series of "&"- separated cmd.exe commands you need to enclose the complete command string in double quotes:
        cmd.exe /c "color 37 & dir"
    Beyond that it can get complicated due to various characters that are special to powershell and those special to cmd.exe. If you need to run a series of cmd.exe commands, your best short term bet is to put them in a batch file. The best long-term bet is
    to move more completely to the powershell way of doing things...
    Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.

  • Running script file from VB

    Hi,
    Is there any shell command or exe to run oracle script file from VB?
    thanx

    You should be able to call WinExec() (Windows API) there are bound to be MS KB articles that cover this. Create a small CMD file that you pass a parameter to with the SQL Script name and then exec that.

  • Thanks for your help. But couldn't run script files

    Hi Saar:
    Thanks for your advise on creating shared folders on VM ware Red hat Oracle to run script files stored on my local F: drive.
    However I got this error when I tried to load and run a script file "Bookscript.sql" in i*sqlplus:
    SP2-0869: invalid file content.
    Path to file is :
    /mnt/hgfs/OracleVM_1/OracleVM_1/9iSQL/JustLeeDatabase/Bookscript.sql.
    Why is this so what can I do to run it?.
    I*SQLPLUS error messages recommends to make sure the browser has "SQL" MIME type.
    Action: Make sure that the script is in a text file and the MIME type settings needed by the browser to recognize the file are set correctly. Typically if you are loading a file with the extension .SQL, make sure the browser has a "SQL" MIME type.
    How do I do that?
    Thanks

    I assume that you are trying with the browser inside the VM, mozilla 1.4 I think. Please try with IE 6 or Netscape 7.2 from the Windows host access the same exact URL it will talk to the linux box, I trust the script will load and this is an issue with how mozilla 1.4 loads files, it might be fixed in later versions of mozilla. If problem still exists, copy the file to /tmp on the linux box and repeat test.
    let us know. In the future please reuse your existing thread until the issue is resolved.
    good luck,
    Saar.

Maybe you are looking for

  • Counter

    Hi, I have LabView Version 6.i and a Timer/Counter Card PCI-6602 from ni. I have an incremental encoder attached to it. I want to measure the frequency of the incremental emcoder an write it into a excel-sheet. Therefore I modified the measure_freque

  • Getting the name of the member on mouse up

    Hi everyone! I am having images as members in my frame.What i want is to get the name of the member (image) when i click the image. I want to write a script on mouseup event of that image and should get the name of the image i have clicked, Thanks

  • ALV Grid: method double_click provides wrong information with 'totals line'

    Hi together, I´m using 'method double_click' with an ALV grid...like: CLASS lcl_events IMPLEMENTATION.   METHOD double_click.     READ TABLE it_outtab INDEX e_row-index INTO s_datatab. Everything works perfect as long as I don´t use totals with it. U

  • AIS Alias Names

    Is it possible to concatenate two columns within AIS to create an alias name?<BR><BR><BR><BR>Jim

  • Setting backups of enteprise portal on Oracle

    Hi, I want to know what optiones there are to schedule backus of a enterprise portal. In the abap part, It can scheduled with the db13 but in enterprise portal? And what can change the default path of the oraarch? I´ve seen the initsid.sap, and i don