-Windowstyle Hidden not working on Powershell - powershell

So I know pretty much nothing about PowerShell but I've been trying to slowly learn.
The end goal is to have PowerShell open up a NOT visible instance of Internet Explorer that navigates to 'Google.com' with the parameters
-noframemerging -private
So far
Start-Process -FilePath 'C:\Program Files\Internet Explorer\iexplore.exe' 'google.com -noframemerging -private'
works in creating an IE but it is NOT hidden.
I also tried another piece of code
Start-Process -WindowStyle Hidden -FilePath 'C:\Program Files\Internet Explorer\iexplore.exe' 'google.com -noframemerging -private'
but the IE window is still visible. How can I fix this?
And -WindowStyle Minimized works.

Start-Process -WindowStyle Hidden iexplore.exe
-ArgumentList "google.com -noframemerging -private"

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 start-process firefox with website and wait until firefox or tab gets closed for next command

Im trying to start firefox with a website expecting input
after finalizing the input and closing firefox or the firefox tab
the next command should start.
I've tried several approaches, but the second command is allways excecuted befor the first ended
$proc = Start-Process -FilePath "C:\Program Files\Mozilla Firefox\firefox.exe" -ArgumentList "https://www.memotoo.com/de/my-addressbook-and-contacts.php?connected=1" -PassThru
Wait-Process -id $proc.id
powershell.exe "C:\temp\Memotoo-EMBROSERVER.ps1"
You can just add the -Wait switch like this:
Start-Process -FilePath "C:\Program Files\Mozilla Firefox\firefox.exe" -ArgumentList "https://www.memotoo.com/de/my-addressbook-and-contacts.php?connected=1" -Wait
powershell.exe -file "C:\temp\Memotoo-EMBROSERVER.ps1"
You need to add a Sleep statement between the two.

Powershell Start-Process works but not from .ps1 script

If I paste this into Powershell blue window it runs fine and launches the program
Start-Process “C:\Program Files (x86)\Engine Pro\engine.exe” -ArgumentList "#21#”;
but if I try to run the same command in a script, run.ps1 script, that launches from a scheduled task in Windows, it does nothing
PowerShell.exe -windowstyle hidden -NoProfile -ExecutionPolicy Bypass C:\run.ps1
Does it have something to do with the -ExecutionPolicy Bypass? Do I have to have an Execution policy in the script as well? I really don't know what that is. I know what -windowstyle hidden is but -NoProfile -ExecutionPolicy Bypass I'm not sure why that is there, just found it on another page, but it's all working except for the program launching from within the script.
Thank you.
& Start-Process "C:\Program Files (x86)\Engine Pro\engine.exe" -ArgumentList "#21#";

Calling a powershell script from InstallShield project

I'm having a weird problem.
I have an InstallShield project (which creates setup.exe) that contains a custom action item - calling a powershell script.
All the script does is to install 3 adobe reader updates (1 exe file and 2 msp files) on top of the already installed Adobe Reader 11.0.0.
When I'm calling the script my self - it works fine.
However, after the setup.exe finishes, it seems like only one update (the exe file) was really installed (the adobe reader version after the install is 11.00.10 which is the result of running only the exe file..).
All 3 adobe updates sit in the same folder and the powershell script first sets it location to this folder.
When running the updates manually after the installation - it also works fine and updates it to 10.00.22 (what it should be).
Any ideas why is this happening?
Here's my powershell script:
Set-Location "C:\myProject\adobeUpdates"
Start-Process .\AdbeRdr11010_en_US.exe -ArgumentList '/q /norestart /sPB /rs /msi' -WindowStyle hidden -Wait
ping 1.1.1.1 -n 1 -w 10000 # Tried to add a delay but wasn't helpful
Start-Process -FilePath “AdbeRdrUpd11021.msp” -ArgumentList '/qn' -Wait
Start-Process -FilePath “AdbeRdrUpd11022_incr.msp” -ArgumentList '/qn' -Wait
Thank you very much
Solved it, this is the working script:
Set-Location "C:\myProject\adobeUpdates"
Start-Process .\AdbeRdr11010_en_US.exe -ArgumentList '/q /norestart /sPB /rs /msi' -WindowStyle hidden -Wait
ping 1.1.1.1 -n 1 -w 10000
Start-Process .\AdbeRdrUpd11021.msp -ArgumentList '/qn' -Wait
Start-Process .\AdbeRdrUpd11022_incr.msp -ArgumentList '/qn' -Wait
I'm not sure what is the different and would love someone to explain but anyway it works just fine now.

Output to New Window in PowerShell

How can I get the output of a command (i.e. get-process) to display in a new powershell window with the the -nologo and -noninteractive options. I've tried all sorts of things that don't work like:
get-process > start-process powershell.exe -nologo -noninteractive
get-process | write-output start-process powershell.exe -nologo -noninteractive
I just can't seem to get my output into a new powershell window, no matter how many ways I Google it. I need to be able to do this when selecting a certain function via my mutli-level powershell menu script.
start -FilePath powershell.exe -ArgumentList "-nologo -noninteractive -command {Get-Process}"
Will do what you asked for but I have a feeling that may not really be what you want.
If you want to output to a new window - Why do you need those options?
This command outputs anything under the command parameter to a new PS Window (sleep timer helps it stay active:
Start-process powershell.exe -ArgumentList '-command Write-Host "Explorer Process Current State" -ForegroundColor Red; gps explorer | ft ; Start-Sleep -s 10;'