Avatar of Pete
Pete
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Run command line command in powersehll

A simple question, what's the best was to run a command line command in powershell?

In my .ps1 script after a load of powershell commands I want to run a line:

Rundll printuientry.....etc

Do I use invoke command or invoke expression or something else?

Thanks
Powershell

Avatar of undefined
Last Comment
oBdA

8/22/2022 - Mon
Shaun Vermaak

I would first look for a native Powershell command.

For example, there are better ways to automate printer without use rundll32 printui.dll,printUIEntry

After that, I prefer to use System.Diagnostics.Process mainly because I develop in .NET
$process = New-Object System.Diagnostics.Process

Open in new window

ASKER CERTIFIED SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy