3 Replies Latest reply on Jul 18, 2018 10:43 AM by florian1

    Printer Mapping - variables and placeholders


      Hi everybody!


      I hope someone can help me.


      I want to map printers through EM to the users. In our case we have printers named like "KOP_001" to "KOP_100". To manage the mapping i would use Active Directory Security Groups named mostly like the printers.

      Now i had the idea that i can build a condition like "User Group ist Equal to KOP_*" and a Printer Map to \\Server\KOP_*


      If possible i would use any kind of placeholders and/or variables to do this with only one condition and not about 100.


      I hope i explained well and anybody can help me. Thanks a lot!

        • 1. Re: Printer Mapping - variables and placeholders
          Kayla.Culpepper SupportEmployee

          Thanks for posting to the Ivanti Community.

          Sorry that it seems no one has the answer to be able to assist you on this yet.  Did you manage to get any further information on this? Please share anything you deem useful and the community may be able to offer some help.

          If not then please do consider the other ways to engage with us to get assistance:





          Kayla Culpepper
          Customer Service Coordinator

          • 2. Re: Printer Mapping - variables and placeholders
            randyb1 SupportEmployee

            Each group condition must be against a specific AD group; you can't use wildcards for the group name.


            Each printer mapping action must be for a specific printer; you can't use wildcards for the printer name.

            • 3. Re: Printer Mapping - variables and placeholders
              florian1 Expert

              You will have to use a script action to fully suit your needs:

              - set a session variable and map your printer referring to the session variable (see "Set-SessionVariable" in this script)


              - map all your printers in the script


              Here's a simple example for Powershell:

              $companyPrefix = "XTN"
              $GroupName = "KOP_*"
              $Printserver = "\\yourPrintServer"
              $memberOf = ([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties.memberof -replace '^CN=([^,]+).+$','$1' | ? {$_ -ilike $GroupName}
              If ($memberOf){    
                  # set a session variable to hold the printer name
                  $PrinterPath = Join-Path $PrintServer "\$($memberOf[0])"
                  Import-Module ((Get-ItemProperty ‘HKLM:\SOFTWARE\AppSense\Environment Manager’).ClientPath + ‘EmCmdlet.dll’)
                  Set-SessionVariable -Name:"$($companyPrefix)_PrinterMapping" -Value:$PrinterPath
                  Get-SessionVariable "$($companyPrefix)_PrinterMapping"
                  # ..or map multiple printers using PowerShell only 
                  $memberOf | % {
                      $PrinterPath = Join-Path $PrintServer "\$_"
                      Add-Printer -ConnectionName $PrinterPath -WhatIf

              Please note that your client needs to be online to execute the script. So you will have to add some exception handlings to make it work in every situation.