Questions tagged [start-process]

Start-Process is a PowerShell cmdlet that starts one or more processes on the local computer.

Start-Process is a PowerShell cmdlet that starts one or more processes on the local computer. To specify the program that runs in the process, enter an executable file or script file, or a file that can be opened by using a program on the computer. If you specify a non-executable file, Start-Process starts the program that is associated with the file, much like the Invoke-Item cmdlet.

You can use the parameters of Start-Process to specify options, such as loading a user profile, starting the process in a new window, or using alternate credentials.

Output

  • None or System.Diagnostics.Process
    When you use the PassThru parameter, Start-Process generates a System.Diagnostics.Process. Otherwise, this cmdlet does not return any output.
255 questions
1
vote
1 answer

pass arguments to the Start-Process script block

Trying to run simple http server in separate process using powershell. But can't figure out how to pass parameters to it. Tried several approaches and constantly getting exception. Could you advice? $port = 9700 $prefix = 'http://+:{0}/' -f $port; …
Alexander
  • 13
  • 2
1
vote
1 answer

PowerShell - Start another instance of PowerShell.exe without elevation and using -NoProfile

I'm trying to run a new instance of powershell.exe (from PowerShell/ISE/pwsh/VSCode) with lowered elevation using its -NoProfile switch but haven't figured out a way to pass the -NoProfile switch in a way that results in a newly non-elevated…
1
vote
1 answer

Start-Process inside Invoke-Command closes immediately unless -wait switch, but how can I continue script?

I'm trying to remotely run this Windows Update Assistance Installer .exe and I notice that the .exe closes immediately unless I use the -wait command. However, if I use the -wait command I can't continue my foreach loop for the other computers since…
DrixlRey
  • 205
  • 3
  • 4
  • 13
1
vote
1 answer

powershell Pipe Operators

I executed the following three powershell commands. The first two commands returned no results, and the third command returned results. The main difference between the three commands is the use of the wait argument and parentheses. PS C:\Users>…
jiligulu
  • 187
  • 6
1
vote
1 answer

How to open SolidWorks sldprt files as read-only with PowerShell?

I built this open-file function in PowerShell for a GUI I wrote that lets you find and open various files on a server. I mainly use it for opening SolidWorks files as read-only, but also for PDF files and it should work for just about any other file…
1
vote
2 answers

Command Line Command Output in start-process from exe file

Here is the program. I am using dell command | configure. The command-line command is as follows: "C:\Program Files (x86)\Dell\Command Configure\X86_64>cctk.exe" --wakeonlan In Powershell you can navigate to the folder and run: ./cctk.exe…
David
  • 891
  • 1
  • 8
  • 18
1
vote
2 answers

PowerShell removes multiple consecutive whitespaces when I pass arguments to a nested Start-Process command

This powershell code works fine: powershell -NoProfile -Command {Start-Process -FilePath wscript.exe -Verb RunAs -ArgumentList '"C:\Users\TestAccount\Desktop\cartella con spazi\test.vbs" "/CurrentDirectory:C:\Users\TestAccount\Desktop\Cartella …
1
vote
3 answers

Install all the files from a given folder with Powershell

I was creating a script of Powershell as a hobby but it can be a tool to be used to install all the files from a given folder after a install from 0. I'm struggling since I don't see where could be the problem. I'm new to PSH but I'm suspicious that…
1
vote
1 answer

Starting an executable from a parent directory in PowerShell

I need to start an executable from a parent folder using PowerShell. This is what I have tried: Start-Process -FilePath ..\Tools\MyTool.exe -ArgumentList "MyArgs" -PassThru -NoNewWindow -Wait This call fails, because the specified file cannot be…
Boris
  • 8,551
  • 25
  • 67
  • 120
1
vote
2 answers

Redirect WSL input in Powershell

I've been trying to write a powershell script that automates my windows workspace setup and configuration and am currently stuck trying to redirect input to WSL when executing it for the first time. The core of the problem is that Ubuntu's first…
1
vote
1 answer

PowerShell terminate java process detected by its commandline

I am starting a java process: $global:TS = Start-Process -FilePath "$pathTS\jdk\bin\java.exe" -ArgumentList "-jar","`"$pathTS\TestServer.jar`"" -WorkingDirectory ` "$pathTS" ` -PassThru -WindowStyle Hidden works fine so far. Now I am trying to…
Alex_DE
  • 25
  • 3
1
vote
1 answer

Start-Process -wait issues with Autodesk Revit

I am seeing some odd behavior with a benchmark that has been working for years. The benchmark is for Autodesk Revit, which can use journal files to automate tasks and log times. The benchmark will read an XML file for a series of modular journal…
Gordon
  • 6,257
  • 6
  • 36
  • 89
1
vote
1 answer

Silent install inside Windows Docker container (NSIS)

For a project at our company we would like to create a Windows container to run a third-party application in the cloud. We use the docker images from this repo as base. The installer of the third-party application uses NSIS and supports silent…
user2416984
  • 941
  • 1
  • 11
  • 18
1
vote
2 answers

How to make powershell wait for a batch file to complete the execution of all comand on remote-server

$storesess = New-PSSession -ComputerName marshy -Credential marshy001 Enter-PSSession -Session $storesess Invoke-Command -ScriptBlock {start-process C:\Users\marshmellow\Documents\Some\xyz.bat } Exit-PSSession Above is the script which calls a bat…
1
vote
1 answer

Starting .ps1 Script from PowerShell with Parameters and Credentials and getting output from it

I think my problem has a simple solution. But now i'm a bit confused. I have Java Code, that starts 1 Powershell Script. This Powershell Script must start other scripts. Java -> Powershell.ps1 -> Script1.ps1 …
Dmytro
  • 372
  • 2
  • 12