1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Procedure executeUpdateLocationPrinter(nomServeurImprimante est une chaîne, nomImprimante est une chaîne, nouvelEmplacement est une chaîne)
idFic est un entier
cheminFichierPowershell est une chaîne
maCommandePowershell est une chaîne = [
Get-ExecutionPolicy
$printer = Get-WmiObject win32_printer -ComputerName %1 | Where-Object {$_.name -eq "%2"}
$printer.Location = "%3"
$printer.put()
Read-Host "Press ENTER"
]
QUAND EXCEPTION DANS
maCommandePowershell = ChaîneConstruit(maCommandePowershell,nomServeurImprimante,nomImprimante,nouvelEmplacement)
cheminFichierPowershell = fRepTemp() + [fSep] + "PS_changePrinterLocation.ps1"
idFic = fCrée(cheminFichierPowershell)
SI idFic <> -1 ALORS
fEcrit(idFic,maCommandePowershell)
fFerme(idFic)
LanceAppli("powershell "+cheminFichierPowershell)
fSupprime(cheminFichierPowershell)
FIN
FAIRE
ExceptionPropage()
FIN |
Partager