none
Removing on %server% from deployed printers. RRS feed

  • Question

  • Hello everyone,

    I am looking for a way to remove the "on xxx" part of the deployed printer name. I would like to display printers as "Test Printer" instead of "Test Printer on Print_Server_1".

    I know you can do that through GPO by adding new TCP/IP printer or a local one but the current setup we have requires me to use shared printers so that our 3rd party software is working as it should and the shared printer option does not allow you to tamper with the name.

    I have seen people attempting the same for network folders using the script below. Is there any chance that could be adjusted to work with printers on win 7 and win 10?

    Call AdjustDriveDescription()


    Sub AdjustDriveDescription

    Dim oShellApp, oWshNet, oDrives, i, sDrive, sDriveDesc
    Dim aDriveDesc, sNewDriveDesc

    On Error Resume Next

    Set oShellApp = CreateObject("Shell.Application")
    Set oWshNet = CreateObject("WScript.Network")
    Set oDrives = oWshNet.EnumNetworkDrives

    For i = 0 to oDrives.Count - 1 Step 2
    sDrive = oDrives.Item(i) & "\"
    sDriveDesc = oShellApp.NameSpace(sDrive).Self.Name
    aDriveDesc = Split(sDriveDesc, " on '")

    If UBound(aDriveDesc) > 0 Then
    sNewDriveDesc = aDriveDesc(0)
    oShellApp.NameSpace(sDrive).Self.Name = sNewDriveDesc
    End If

    Next
    On Error Goto 0
    End Sub

    • Moved by Bill_Stewart Wednesday, September 13, 2017 9:41 PM This is not "scripts on demand"
    Tuesday, August 1, 2017 12:23 PM

All replies

  • You should be using PowerShell as VBS is mostly obsolete.

    Get-WmiObject  Win32_Printer | select name

    In VBScript you can use "Split" to get the first part of the string:

    https://www.w3schools.com/asp/func_split.asp


    \_(ツ)_/

    Tuesday, August 1, 2017 3:56 PM
  • Unfortunately there is no way to rename a network printer from the client side. If it is a local printer, you can use the cmdlet rename printer, however it does not work for network printers.

    I tried to find a way using register, but I found nothing. Sorry about that.


    Ajude a melhorar a eficiência nas buscas, se foi útil, classifique. {http://rafaelcmachado.spaces.live.com} Rafael Carneiro Machado

    Thursday, August 3, 2017 3:25 PM