Jump to content

Wise112

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Wise112

  1. I have managed to find a workaround which seems to be working; Thanks all! $printername = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device") $printername = StringTrimRight($printername, 15) $RegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\" & $printername & "\" $RegKey2 = RegRead($regkey,"Port") MsgBox(0, "Your Printer Port is ", $Regkey2)
  2. Hello All, I was wondering if it was at all possible to make a location within the registry a variable; $var1 = PRINTER1 ie: $port = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\$var1", "Port") If anyone could give me some direction it would be great! Tim
  3. So far i have the following; ;Default / mapped printer (will read back the printer / session number of the user) $printername = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device") $printername = StringTrimRight($printername, 15) This is the part im having trouble with; Is it possible to enter the next key like so; RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\", "$printername") then export / copy the "port" key If anyone has anything to add with where i might be going wrong or tips on how i should be writing / arranging the script in general
  4. runwait( @comspec & " /c taskkill /pid 4424 /f","",@SW_HIDE) This worked for me when i had a quick play around with it not sure if there would be a better way (im sure there is)
  5. Hello, I have spent a couple of days trying to get this to work but i keep going around in circles and wondered if i could get some guidance; Overview: I have a program which requires users to have a printer a set name lets say "printerABC"). Since this is a terminal server when a user logs in and it maps their local printer as PrinterABC (from USERNAME) in session X i have managed to get this working by manually creating a pritner on LTP1 then changing the port to their TSPrint port Aim: Read a set pritner, or users default mapped printer / printer port; HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Pritner ABC(from USERNAME) in session x Key: Port - TS0xx Apply this port number to the FIXED printer HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Printer ABC Key: Port: TS0xx This will then trick and allow the program to print to the LTP1 Pritner which forwards to the TS Printer Port The trouble im having is i cannot set a variable in a registry key to update the USERNAME and session X PrinterABC (from USERNAME) in session X ie: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Pritner ABC(from $username) in session $sessionNum if anyone can give me some guidance it would be greatly appricated! Tim
×
×
  • Create New...