pcjunki Posted May 23, 2012 Share Posted May 23, 2012 i've googled and oogled all over the net to try and find some software to do what i want, and can't find it. so, here i am.... here is my "goal of what i am looking for" to remotely query a compuer (current user logged on) and list the current installed "local" and "mapped printers" and be able to set a default printer anyone know how to do this? or know of any free software to do this? Link to comment Share on other sites More sharing options...
UEZ Posted May 23, 2012 Share Posted May 23, 2012 (edited) Try this: $sHost = @ComputerName $sDefaultPrinter = "Microsoft XPS Document Writer" WMI_SetDefaultPrinter($sHost, $sDefaultPrinter) Func WMI_SetDefaultPrinter($sHost, $sPrintername) ;coded by UEZ 2012 Local Const $objWMI= ObjGet("winmgmts:{impersonationLevel=impersonate}!" & $sHost & "rootcimv2") If @error Then Return SetError(1, 0, 0) Local Const $oItemsList = $objWMI.InstancesOf("Win32_Printer") Local $oPrinter For $oPrinter In $oItemsList ConsoleWrite($oPrinter.Name() & @CRLF) ;print printers to console Next Local Const $oItems = $objWMI.InstancesOf("Win32_Printer Where Name='" & $sDefaultPrinter & "'") If $oItems.Count Then For $oPrinter In $oItems $oPrinter.SetDefaultPrinter() Next Else Return SetError(2, 0, 0) EndIf EndFunc Will set "Microsoft XPS Document Writer" as default printer if available. Br, UEZ Edited May 23, 2012 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
pcjunki Posted May 23, 2012 Author Share Posted May 23, 2012 getting a error, line1 unknown macro Link to comment Share on other sites More sharing options...
UEZ Posted May 23, 2012 Share Posted May 23, 2012 Update your AutoIt version to latest one! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
pcjunki Posted May 23, 2012 Author Share Posted May 23, 2012 just did, same error Link to comment Share on other sites More sharing options...
UEZ Posted May 23, 2012 Share Posted May 23, 2012 Can you post the whole SciTE console output please? I cannot believe that @ComputerName is an unknown macro. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now