Jump to content

Printermapping via Autoit


Recommended Posts

Hello,

i made a script what maps me a printer from a server and makes this printer the default printer, i used rundll functions for this, but i think there should be an "autoit way" to do printermappings - are there any suggestions ?

RunAsSet("administrator", "domain", "password")

$befehl1="Rundll32 printui.dll,PrintUIEntry /in /n " & @LogonServer & "\HPLaser"

$befehl2="Rundll32 printui.dll,PrintUIEntry /y /n " & @LogonServer & "\HPLaser"

_RunDos ($befehl1)

_RunDos ($befehl2)

RunAsSet()

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Link to comment
Share on other sites

Hello,

i made a script what maps me a printer from a server and makes this printer the default printer, i used rundll functions for this, but i think there should be an "autoit way" to do printermappings - are there any suggestions ?

......

<{POST_SNAPBACK}>

If you want to use the Beta version of AutoIt3 (current version v3.1.1.48) you can do things like this:

; Add printer example using AutoIt3 and WSH
;
; See also: http://msdn.microsoft.com/library/en-us/script56/html/wsmthaddwindowsprinterconnection.asp

; Connect to WSH
$WshNetwork = ObjCreate("WScript.Network")
$PrinterPath = "\\printserv\PrinterQueue"

; Add network printer
$WshNetwork.AddWindowsPrinterConnection($PrinterPath)

; Set printer as default
$WshNetwork.SetDefaultPrinter($PrinterPath)

However, this script will only work on Windows 2000 or higher.

Regards,

-Sven

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...