Find argument list for an installation exe - powershell

I am a complete Noob on Windows and, for the first time of my life, I have to make a Powershell script to install various services on a server. From what I understood, silent installations are made this way:
Start-Process "C:\Path\To\some_installer.exe" -ArgumentList "/some /argument" -Wait -PassThru
But I cant figure a way to identify what the arguments should be for this given .exe. On Linux, I would launch the installer and answer to the prompts one by one to know what the arguments are supposed to be. Then:
(echo arg1; echo arg2) | my command
But since Start-Process does not display a similar behavior (or I am not using it properly), I am lost. I tried the -RedirectStandardOutput but getting nothing in the output file. How do you identify the argument list to provide?

Just like Linux, Windows has many package installation tools. The difference is that the Windows installers are mostly designed for GUI. So there is no standard for CLI. For each installation, you need to check for the installer.
If it's an MSI file, you can use the Microsoft docs. If it's an executable, you need to check for the installer. Many software use common installation wizards, but many of them use custom ones.
If you want to use it like Linux, you can use scoop or chocolatey. You can have a local repository in your network then share. Or just use internet. Then you can have silent installation by default.

Related

Can I put a value to input of already installed program with powershell?

I need to put a serialkey to already installed VMware Workstation with powershell. I know, that you can install it with parameter SERIALNUMBER="xxxxx-xxxxx-xxxxx-xxxxx-xxxxx", but there must be another way. I tried to start VMware with default instalation an put license key in GUI window, but it doesn't work at all.
How that GUI looks like
Do you have some ideas? Or is it even possible?
&"C:\Program Files (x86)\VMware\VMware Workstation\vmware.exe" /s SERIALNUMBER="xxxxx-xxxxx-xxxxx-xxxxx-xxxxx"
I tried run that app with this values, but it doesn't work.

How to install the WASP in powershell?

I want to use WASP plug-in in powershell. Lack of knowledge about c#, I have no idea how to install it. I have downloaded the archive file from https://archive.codeplex.com/?p=wasp . I haven't found a "install" file in the zip. There is no user guide for installation on the page, either. I would like to install it from powershell. My system is windows10, 64bits. I need some help, thank you.
You can use SendKeys directly via PowerShell.
# Example, start notepad, grab all services and display in in notepad using SendKeys
Notepad
Get-Service | Clip
Start-Sleep -Seconds 1
## .NET:
[void][reflection.assembly]::loadwithpartialname("system.windows.forms")
[system.windows.forms.sendkeys]::sendwait('^v')
Yet, WASP and other tools like if are better options. However, WASP is a very old project and has not been maintained in years. I have it as do many other and used it in the past. From CodePlex, you need Visual Studio ( you can use the free community edition) to compile that into a DLL to be imported. Yet again , it's very old. So, there are other tools to use for GUI automatization vs WASP.
See:
PowerShell module to run a Selenium WebDriver.
PowerShell & Selenium: Automate Web Browser Interactions
PowerShell, Selenium and Browser Automation
AutoIt Cmdlets for Windows PowerShell
https://www.autoitscript.com/forum/topic/187775-run-powershell-script-with-autoit
https://www.autoitconsulting.com/site/scripting/autoit-cmdlets-for-windows-powershell

Why does my installer not run while using the /norestart flag?

I am going for a silent installation for one of my msi exe. The goal is to get the installer to run silently. I understand and know how to run it silently. The task at hand is that when I run it silently the OS restarts. So I implemented an additional flag to take care of the restart along with my silent flags. Below is the command I run for silent and no restart.
JumpyJackGame.exe /s /v/qn /norestart
The problem I am running into is the .exe does not even run when I add the /norestart command
What project type are you using? And do you use a Suite project (essentially a bundle of several setups delivered as a single setup.exe) or just a regular project wrapped in a normal setup.exe launcher?
See the official help for these different setup.exe types:
Setup.exe and Update.exe Command-Line Parameters
Advanced UI and Suite/Advanced UI Setup.exe Command-Line Parameters
If you use a regular Basic MSI (which you should for its standards compliance), then you might be able to do this:
Setup.exe /s /v"/qn REBOOT=ReallySuppress"
See more samples in the documentation. The REBOOT=ReallySuppress should stop rebooting from "normal causes". A custom action designed to do so may still be able to force-restart the system, but that is terrible design if implemented in such a manner (it should register the need to reboot only).
I will add a link in the morning - when I get time - to a previous answer on the different setup.exe types.

Silent Installation of FortiClient.msi VPN Only

I am trying to do a silent installation of FortiClient.msi, and here is what I have so far:
Start-Process "[Insert MSI Path]" /qn -Wait
I would like to make sure that the VPN is the only part that is installed. Is there a parameter that tells the msi to only install VPN, or will the installer automatically install VPN only?
You can open the msi file with ORCA and check the possible Properties. For example there is a property DISABLEFEATURE which could do your wanted stuff.

Where does the version number in PowerShell title refer to?

In this post I found the way to detect the installed Powershell version: Determine installed PowerShell version.
When I type "powershell" into "Execute as" (Win+R) the powershell opens with the title:
C:\Windows\System32\WindowsPoershell\v1.0\powershell.exe
However, the commands from the linked SO question deliver following output:
So my question: Why is there v1.0 in the title of the shell window whereas the other commands tell me that I have version 2?
Your PowerShell version is 2. The title shows the path to the PowerShell executeable. I think the reason why all new PowerShell version are located there (in v1.0) is because so many cmd scripts invoking some PowerShell code using this file path (e. g. Scheduled Tasks). But I may be wrong.
Another reason could be, that its not possible to run two different PowerShell Versions side-by-side.