Salut tout le monde,

je ne sais pas comment en powershell on precise au serveur d'impression que l'imprimante que je viens de créer est de tel ou tel modele.

J'aimerais aussi forcer un parametre par default mettre l'imprimante en noir en blanc

pour creer une imprimante je fais ca

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$NAME= "TEST"
#function CreatePrinter {
echo "Début creation printer"
$server = "S03993V0"
$print = ([WMICLASS]"\\$server\ROOT\cimv2:Win32_Printer").createInstance()
$print.drivername = "KONICA MINOLTA Universal PCL"
$print.PortName = $NAME
$print.Shared = $true
$print.Sharename = $NAME
$print.Location = "GEN / $NAME"
$print.Comment = "Gestionnaire : HELP/SDP"
$print.DeviceID = $NAME
$print.DoCompleteFirst=$true
$print.Default=$false
$print.Published= $true
$print.Put()
echo "fin creation printer"
#}
je trouve pas un truc qui dirait
ou je sais pas quoi

et pour le modele
Code : Sélectionner tout - Visualiser dans une fenêtre à part
$print.model="kyocera...."

j'ai regarder rapidement ça : Set-PrintConfiguration
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
The term 'Get-PrintConfiguration' is not recognized as the name of a cmdlet, function, script file, or operable program
. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:23
+ Get-PrintConfiguration <<<<  -ComputerName "." -PrinterName "TEST"
    + CategoryInfo          : ObjectNotFound: (Get-PrintConfiguration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
Name                           Value
----                           -----
CLRVersion                     2.0.50727.5485
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1

est ce que cela peut venir de ma version {2}

dois upgrader ? en 4 ou les commande que j'ai taper son valable que pour WS 2012 sachant que je suis sur 2008



correction:

j'ai tester sur un powershell4 sur w7 pro et pas serveurcela donne ca

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.18444
BuildVersion                   6.3.9600.16406
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2


PS C:\Users\user\contacts> Set-PrintConfiguration
Set-PrintConfiguration : Le terme «Set-PrintConfiguration» n'est pas reconnu comme nom d'applet de commande, fonction,
fichier de script ou programme exécutable. Vérifiez l'orthographe du nom, ou si un chemin d'accès existe, vérifiez que
le chemin d'accès est correct et réessayez.
Au caractère Ligne:1 : 1
+ Set-PrintConfiguration
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Set-PrintConfiguration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException



Merci beaucoup