Bonjour à tous,

Je développe un module d'impression et je me heurte à un problème. Je dois publier mon application en utilisant Citrix XenApp 6.5.

Mon problème est pour l'utilisation des imprimantes clients. Si je lance mon application dans une session Desktop de XenApp aucun problème, il me liste toutes mes imprimantes.
Par contre si je publie mon application, il me liste uniquement les imprimantes installées sur le serveur.

J'ai deux méthode pour obtenir les imprimantes (Windows form avec juste combobox nommé 'cmbPrinters'):

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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'''''''RETRIEVE INSTALLED PRINTERS
        'Dim printer As PrinterSettings.StringCollection, IdxImpParDefaut As Integer, i As Integer
        'printer = Printing.PrinterSettings.InstalledPrinters
        'cmbPrinters.Text = printer.Item(0)
        'i = 0
        'IdxImpParDefaut = 0
        'For Each p In printer
        '    cmbPrinters.Items.Add(p.ToString())
        '    If p.ToString() = DefaultPrinterName() Then IdxImpParDefaut = i
        '    i = i + 1
        'Next
        'If cmbPrinters.Items.Count > 0 Then cmbPrinters.SelectedIndex = IdxImpParDefaut
        '''''''RETRIEVE ALL PRINTERS
        Dim oquery As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_Printer")
        Dim mosearcher As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher(oquery)

        Dim moc As System.Management.ManagementObjectCollection = mosearcher.Get()

        For Each mo As ManagementObject In moc
            cmbPrinters.Items.Add(mo.Properties("name").Value.ToString())
        Next mo
        '''''''RETRIEVE CITRIX PRINTERS
        'Dim rsConfig As RunspaceConfiguration
        'rsConfig = RunspaceConfiguration.Create()
        'Dim info As PSSnapInInfo
        'Dim snapInException As New PSSnapInException
        'info = rsConfig.AddPSSnapIn("Citrix.XenApp.Commands",
        'snapInException)
        'Dim myRunSpace As Runspace
        'myRunSpace = RunspaceFactory.CreateRunspace(rsConfig)
        'myRunSpace.Open()
        'Dim pipeLine As Pipeline
        'pipeLine = myRunSpace.CreatePipeline()
        'Dim myCommand As New Command("Get-XAPrinter")
        'pipeLine.Commands.Add(myCommand)
        'Dim commandResults As Collection(Of PSObject)
        'commandResults = pipeLine.Invoke()
        'For Each cmdlet As PSObject In commandResults
        '    cmbPrinters.Items.Add(cmdlet.Properties("Printername").
        '    Value.ToString())
        'Next
La dernière partie de code ne fonctionne pas, il me met dans citrix que la commande Get-XAPrinter est inconnue.

Quelqu'un a une idée à me proposer? Sachant que si je publie l'application wordpad et que je veux imprimer, il me liste bien toutes les imprimantes....

Merci,

Jérôme