Make ms-edge Window full screen (F11, normally) via powershell script - powershell

I'm trying to make ms-edge Window full screen (F11, normally) via powershell script.
This is an example of the powershell script I'm using to start edge:
Start-Process -FilePath msedge -ArgumentList '--new-window www.google.com'
This works fine. However, I want the edge window to be full-screen, like what happens when you press F11 while in the browser. This action cannot be dependent on the windows user or individual user ms-edge profile settings. I need it to be done from the script - if that is possible - so the action is the same for all users when they run the script.

Start-Process msedge.exe https:\\google.com -WindowStyle Maximized

if you're looking to start it in Full Screen mode, you can use the start-fullscreen switch.
--start-fullscreen.
So, it would be:
Start-Process -FilePath "msedge.exe" -ArgumentList '--new-window www.google.com --start-fullscreen'
Here are the content switches / source you can use, where start-fullscreen is shown as well.

I also recently wanted to open a web page in full-screen mode simply via a shortcut in autostart.
--start-fullscreen did not work, for whatever reason.
--kiosk www.google.com --edge-kiosk-type=fullscreen worked, but Edge is started in private mode and some functions no longer work.
Now I found out that --start-fullscreen does not work in connection with the "startup boost" of Edge. As soon as this is switched off in the settings, the parameter works again.

Related

MS Edge: Powershell script to open three SEPARATE/independent MS Edge Windows (not tabs!)

I working on a network operations center type setup. On this particular PC, I have eight monitors. I have some software that will POSITION certain windows on certain monitors just after they launch. That's not my problem.
My problem is that each of the eight monitors needs to display a full screen instance of MS Edge. When I launch edge from a powershell script, each new launch of the application starts in a TAB of the FIRST instance of MS Edge instead of a completely independent window.
I'm using a powershell script like this as an example:
[system.Diagnostics.Process]::Start("msedge","https://something.com/somefile1.aspx")
[system.Diagnostics.Process]::Start("msedge","https://somethingelse.com/somefile2.aspx")
...however I'm open to using whatever powershell script syntax accomplishes my stated goal.
These open up in tabs instead of independent MS Edge application windows. Since this is in a NOC, I need to be able to script this independent of any windows user-specific settings - I need to be able to start the windows the same way regardless of which person is actually logging in.
Thanks in advance!
Use the --new-window switch
Start-Process -FilePath msedge -ArgumentList '--new-window www.google.com'
Start-Process -FilePath msedge -ArgumentList '--new-window www.bing.com'

Powershell script with "-WindowStyle Hidden -NonInteractive" still causes a console window to open momentarily

I'm working around an annoyance with the Win 10 start menu that can't handle multiple shortcuts (start menu tiles) to the same executable command. I want to have individual start menu items to open named PuTTY sessions using PuTTY -load SessionName
So, I have created a small powershell (PS) script file for each session like:
# ----Open named PuTTY session----
$PF= ${Env:ProgramFiles}
$exe= "Other\PuTTY\putty.exe"
$session= "Servername (login)"
$PuTTY= Join-Path $PF $exe
& $PuTTY -load $session
I can then create a shortcut to this script, with the shortcut target set to-
powershell.exe <path to ps1 script file>
and pin the shortcut to the start menu.
This works well, but as the script runs you can see a powershell console window flick open and then close as the script runs. I want to get rid of this annoying flicker of the PS console window.
I have experimented with adding the -WindowStyle Hidden and/or -NonInteractive options to the command line in the shortcut, but the annoying flicker of the powershell console still happens.
I would have expected -WindowStyle Hidden to make PS run in the background with no display window. Is that not the case? or is there another way to achieve a truly "invisible" PS script?

How can I get the handle of each Firefox windows in Powershell?

I'm trying to get the handle of each windows opened by the firefox process. My use case is the following: on a computer in kiosk mode, I'm opening firefox at a specific URL with a powershell script at startup. That URL directs to an application that opens a new window that conveniently disable the use of the URL bar, preventing the user to browse the web. My problem is that the old window is still opened and I want to close it programmaticaly through that same powershell script. Although, the two windows have the exact same name so I can't use this to tell them apart.
I've tried listing the windows handles of the firefox process but it doesn't work since there is only one. I've also tried closing the main window of that process but since the pop up is coming up front, it's considered as the main window and so that is the windows that is closed.
There must be a way to select the correct window and close it because it is doable through the task manager.
edit: As a complement, I'd like to mention I tried what is mentioned in this thread but it doesn't work either.
I managed to circumvent my issue by launching firefox as a hidden window. The pop-up then comes up correctly and I'm happy with the result.
$firefox = Start-Process -FilePath "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -ArgumentList "https://myurl" -WindowStyle hidden
Start-Sleep -Seconds 2
Show-Process -Process $firefox

extracting a WinRar file silently using powershell blocks with a GUI Pop-up asking Yes or Yes to All or No or No to All

I am extracting a WinRar file silently using power shell but a popup comes up asking Yes or Yes to All or No or No to All.
How to do it completely silent and if it is possible to extract in another folder ?
I have run below command.
Start-Process 'directory\jre-6u37-windows-i586.exe' -ArgumentList "/s" -Wait
For example, if I have a SFX Archived file in temp folder and when I run the powershell command below I get attached popup for confirmation. How can I make the command complete silently?
Start-Process 'C:\temp\test' -ArgumentList "/s" -Wait
The following dialog pops up:
Without a screenshot of the particular pop up, my guess is the popup you are referring to is the one from PowerShell and not from the process you are starting.
If that's the case its probably tripping your $confirmpreference setting.
You can try either setting $confirmpreference to "none" or you can try adding the parameter -confirm:$false to your cmdlet.

PowerShell exiting

I have a script I wrote in PowerShell ISE that works perfectly.
It even works if I copy and paste it into regular PowerShell. However when I run it with regular PowerShell by making it the default program to open it with, then double-clicking, it just opens, displays some red text, and closes.
Is there a way to stop it from closing so I can view the red text or is this a common issue that can be fixed easily?
Try running from cmd prompt using:
powershell -noexit <path to the script>
Additionally, I think the error script may be throwing could be due to execution policy on your machine blocking the script from executing. Otherwise transcript would work. Ensure that the execution policy is set appropriately using Set-ExecutionPolicy cmdlet.
The practice of setting Powershell scripts to run when double clicked is highly discouraged for security reasons. Please ensure you are aware of the risks involved before you proceed.
You cannot simply 'make Powershell as default program' through the Windows Explorer interface. The Run with Powershell context menu option uses the following command:
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-Command" "if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'"
The "safest" way (bearing in mind the above caveat) to do what you are trying to achieve is to use Default Programs Editor to set the Run with Powershell context menu option to be the default.