Issue selecting “landscape” with ExecWB(8,1) in PowerShell

I’m issuing the below commands in hopes of changing print settings, prior to changing my parameter (8,1) to (6,2). I can get the header and footer options to hold, but “landscape” does not. Instead, the settings default back to “portrait”.

Any help would be appreciated. Thank you!


$ie = New-Object -comObject InternetExplorer.Application
$ie.silent = $true
while ($ie.busy) { sleep 1 }
$ie.visible = $false


Not entirely sure if I know what you are asking, however, I had no issues with changing from Portrait to Landscape and back again using your example.


Forgot to mention, this is also posted here:


Thank you for the reply Tony. Essentially I am using (8,1) to set the printing settings I want. Once the settings are set, my plans would be to change the values to (6,2) so the print job initiates silently. However, the issue I am running into is that “landscape” is the only setting that wont save. After I change the settings to “landscape”, and print using (6,2), the document prints out “portrait”. When I change the values back to (8,1) to verify the settings, the selection is back to the default “portrait”, whereas all other settings (headers and footers) stay the way I initially set them. It’s as if the orientation is the only setting not saving and I don’t understand why.


Sorry for the rough description prior.

Interesting. Sorry I cant help as it works as expected for me. Good luck and if you find the solution, please post.

This site is major wonky these days. I just replied to this post and got this error (as I have many times lately)

“There has been a critical error on your website.”

When this happens, the main forum page does not show any updates/changes so others are unable to see changes.

FYI … my $.02

Interesting. I’ll keep looking into it. Thank you for your help!

Are you testing it by running the script with $ie.ExecWB(8,1) changing the setting to landscape, then modifying the script to $ie.ExecWB(6,2) and running it again? If so, I can replicate the behaviour - the setting doesn’t get saved between runs.

However, if you put the $ie.ExecWB(6,2)directly below the $ie.ExecWB(8,1) as Tony posted, and run the script once, it prints landscape.


Sorry about the formatting of the second paragraph. I gave up trying to make it look nice.

Perfect, thank you! That worked for me. I appreciate your help Matt.