How to quote path for Start-Process over cmd.exe? - powershell

Why does
Start-Process -Wait 'C:\scripts\install.cmd'
work
adn the following does not
Start-Process -Wait 'C:\scripts(1)\install.cmd'
How to make it work?

I tried to reproduce but it worked for me. My PowerShell version is 5.1.19041.906. Maybe there is something wrong with the install.cmd script?

Related

Running cmd.exe from Powershell and passing another exe application as a Parameter

Ok so I have been looking for an example on how to do the following but can't seems to find the correct answer. I have found a lot of things that are close but won't work. This code is being run from within a PowerShell script if matters or makes a difference.
Here is the code snip:
Start-Process -FilePath cmd.exe -ArgumentList /k "msdgen170.exe" -Wait -WindowStyle Maximized -Verb RunAs -WorkingDirectory "C:\Program Files (x86)\3E\msdgen"
It works as far starting the cmd window but I can't seem to get the msdgen170.exe application to be passed to the window. It opens and stops at a prompt. I have tried the & but that doesn't work either.
What am I missing?
Thanks for helping to point me in the correct direction.

Powershell script is not installing an exe while i try it runs through TFS Build

I have a powershell script which will install an exe. It works fine when i try it from a powershell ISE console, but it fails when i try it from TFS build step.
Note : My TFS user, agent user and triggering user are same.
Could anybody can shed some light on this issue ?
Start-Process -FilePath $installerFileName -Verb "runas" -ArgumentList $parameter -Wait
The above code is using to install the exe. $parameter is a list of custom parameters.
I am getting below error
[WixSession.GetSession][GetSessionValues]exception: Value cannot be null. Parameter name: s
What kind of exe are you trying to install? Dose that support silent installation? If UI pop up during the installation, then the agent needs to run in interactive mode.
Test on my side with below command to install/unistall the notepad++ with service mode, everyting works as expected:
start-process -FilePath "D:\Software\npp.7.5.8.Installer.x64.exe" -ArgumentList '/S' -Verb runas -Wait
And:
start-process -FilePath "C:\Program Files\Notepad++\uninstall.exe" -ArgumentList '/S' -Verb runas -Wait

How to silently install exe using powershell

I am trying to install trial version of Lotus Notes Designer using Powershell command
Start-Process -FilePath "EXEPath" -Verb runAs -ArgumentList "/qn"
But this command displays the normal installation wizard, how do I make it a silent installation?
Silent Install commands vary depending on the program itself and the installer they have used. Using /qn will work for most (but not all!) MSI installers, as there is a Microsoft standard that most will follow, but EXE installers can be very different as they do not have guidelines like an MSI.
Searching for the name of the program and 'silent install' will likely bring up the programs help pages or a blog which lists the commands you will need to use.
A search for "lotus notes designer silent install" brings up this article which lists the command as:
setup.exe /s /v"/qn"
Which you would use like this:
Start-Process -FilePath "C:\folder\setup.exe" -Verb runAs -ArgumentList '/s','/v"/qn"'
Note: I can't test this as I don't use Lotus Notes, but it should work, or at least give you a good idea on what to do.
Please try below command in powershell, it will install silently along with wait and ouput. Note: Your installer should be supporting /S option and didn't try with LotusNotes.
Start-Process .\installer.exe /S -NoNewWindow -Wait -PassThru
use this
Start-Process -FilePath "D:\Software\app.exe /S /NoPostReboot _?=D:\Software\app.exe" -NoNewWindow -Wait -PassThru $process.ExitCode

Silent install an Installsheild that contains an MSI in Powershell?

I have an executable Installshield setup file that I need to install silently. It appears to call an MSI file as MSIEXEC is launched during installation. I've tried this in powershell:
Start-Process "C:\temp\mysetup.exe" -ArgumentList "/s /v /qn" -Wait
However that launches the GUI. Any ideas what I'm doing wrong? I've searched and searched and this seems to be what all the cool kids are doing but it refuses to work for me. Many thanks. :)
You can try the "Universal Silent Switch Finder" (ussf) to find and confirm the switch usage.
I figured it out - was just a syntax issue:
ORIGINAL:
Start-Process "C:\temp\mysetup.exe" -ArgumentList "/s /v /qn" -Wait
WORKING:
Start-Process "C:\temp\mysetup.exe" -ArgumentList '/s','/v/qn' -Wait
Thanks for the advice!

EXE silent installation

I have following PowerShell script to install application without user intervention:
Start-Process -FilePath "C:\Temp\UpgradeClientInstaller\setup.exe" -ArgumentList "/S /v/qn"
by giving /s in argument list, it should install silently without user intervention but a popup is showing
Even I try with winrar.exe and zip.exe files giving the same result. Is this right way to do?
Have you tried the following command?
Start-Process -Wait -FilePath "C:\Setup.exe" -ArgumentList "/S" -PassThru
Please try this:
$pathvargs = {C:\Temp\UpgradeClientInstaller\setup.exe /S /v/qn }
Invoke-Command -ScriptBlock $pathvargs
Try this:
Start-Process -Wait -FilePath C:\setup.exe -Argument "/silent" -PassThru
Start-Process -Wait -FilePath "\full\path\setup.exe" -ArgumentList '/S','/v','/qn' -passthru
The quotes of the execute file are not necessarily.
I know the post is super old, but I feel like I could share some insight on the matter
I had to do something similar a few years ago. When you click "install" on the prompt, all it's doing is adding the cert to the TrustedPublisher store. That prompt can be avoided if you manually add it to the cert manager prior to running the installer.
I found that if you install the program on a test machine, you can export the Cert from certmgr.msc. Then you can install the cert using:
certutil -addstore "TrustedPublisher" <PathTo.cerFile> >nul 2>nul
This will install the cert to the TrustedPublisher store therefore eliminating the need for that message to appear.
I hope this helps Ramesh as well as anyone else who finds this in the future
Use this command it will not ask for any click on next and install the software.
Start-Process -Wait -ArgumentList "/silent" -PassThru -FilePath 'C:\Users\filename.exe'
Your problem seems to be Windows UAC and not the script itself.
Go to Control Panel -> System and Security -> Security and Maintenance
Click Change User Account Control settings.
Set the slider to "Never Notify".
This may be risky - but it works.
add the -NoNewWindow to stop the popup