Avatar of jskfan
jskfan
Flag for Cyprus asked on

Add-printer command on Powershell Version 2

Add-printer command on Powershell Version 2


I am trying to run add-printer powershell command   but I m getting error.
add-printer -name "MyTest Printer" -drivername "Canon MX920 series Printer"

Thank you

PS C:\Users\administrator> add-printer -name "MyTest Printer" -drivername "Canon MX920 series Printer"
The term 'add-printer' is not recognized as the name of a cmdlet, function, script file, or operable p
 spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:12
+ add-printer <<<<  -name "MyTest Printer" -drivername "Canon MX920 series Printer" -port "Envy"
    + CategoryInfo          : ObjectNotFound: (add-printer:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\administrator>

Open in new window


the remote computer is running Version 2 of Powershell

PS C:\Users\administrator> $psversiontable

Name                           Value
----                           -----
CLRVersion                     2.0.50727.5420
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1


PS C:\Users\administrator>

Open in new window

PowershellVB ScriptWindows BatchScripting LanguagesPrinters and Scanners

Avatar of undefined
Last Comment
jskfan

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Qlemo

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.
jskfan

ASKER
You'll have to fall back to e..g VBS code.

Can you please provide the script.

I need to add a printer (Printer Name, Host Name, Standard TCP/IP, Driver) Then enable the option  to "print directly to printer"

Actually I was able to do all that with Powershell command but not on Windows 7


Thank you
jskfan

ASKER
Thanks.. I will post a question for VBScript
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck