Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm sure this has come up a million times but i'm looking for a quick answer / solution. I have a client that uses a database program that creates an .ini file for printer settings. The problem is that everytime the enduser logs in her printer is redirected to a "TSXXX" port. this port is constantly changing which is of course normal, but each time she logs in since it has changed the .ini file entry for the printer is incorrect as it has changed. The EU then has to go through the whole printer setup each time she logs in to the TS. Is there a way to statically assign the port? or some how make it constant so each time she log in the port remains the same?

share|improve this question
    
If it's not possible, can you share her printer out and install it on the 2008R2 server? –  KJ-SRS Apr 3 '12 at 20:16

1 Answer 1

The ugly: make a batch that find the port and update the ini file at logon.

Exemple of script to parse printer (vbscript) (it set default printer to MYSPECIALPRINTER): use objprinter attributes (Path i think) to get tsclient path

Set objNetwork = CreateObject("WScript.Network") 
Set objWMIService = GetObject("winmgmts:" & _
    "{impersonationLevel=Impersonate}!\\" & "." & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
        ("SELECT * FROM Win32_Printer")
    For Each objPrinter in colInstalledPrinters
        '''wscript.echo ("Imprimante : " & objPrinter.Name & VbCrLf)
        If (left(LCase(objPrinter.name),4) = "MYSPECIALPRINTER") then

            objNetwork.SetDefaultPrinter(objPrinter.Name)
''wscript.echo ("Imprimante : " & objPrinter.Name & VbCrLf)

        End If

    Next
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.