slybry70 Posted June 19, 2020 Posted June 19, 2020 Afternoon all, I am working on a PRINTUI script that does various things but at the moment I am tackling exporting drivers from a network server to another domain location. this is the case I have so far. Case $Exportdriverb GetPrintServer() GetPrinterName() $Filepath = "\\" & $PrintServer & "\" & $PrinterNameString $DriverFilePath = "\\EPEPS007\printer_configs$\DATs\config.dat" RunAsWait ($Username, "SL6.MYCompany-INT.ORG", $Password, $RUN_LOGON_NETWORK, 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n ' & $FilePath /a "\\EPEPS007\printer_configs$\DATs\config.dat") This is only the case section but it stands alone other then variables coming into it. I use the RunAsWait command in other area's of the script and it works. I also tried this and it gave me an unknown function name error. RunAsWait ($Username, "SL6.MYCompany-INT.ORG $Password, $RUN_LOGON_NETWORK, 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n ' "\\PRINTER\ITD0042" /a "\\EPPEPS007\printer_configs$\DATs\config.dat") This section works to bring up printer properties with no issues so most of the script is correct. It seems to not like the /a but not sure. RunAsWait ($Username, "SL6.MYCompany-INT.ORG", $Password, $RUN_LOGON_NETWORK, 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /p /n ' & $FilePath & '', "") According to microsoft this is the format it should take: RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n "printer" /a "file.dat" I am sure I am just putting the arguements in wrong but have tried everything I can think of. It doesn't like the /a. but according to microsoft and all other websites out there it should be in there. Any help is appreciated. Thank you.
slybry70 Posted June 24, 2020 Author Posted June 24, 2020 So update.. I have verified that this command is working in command prompt. RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n "\\PRINTSERVER\ITD0042" /a "\\pepeps007\printer_configs$\DATs\config.dat" This is my current line and its almost running! There are no errors and grammar seems correct. Only thing is that Its still not recognizing the /a RunAsWait ($Username, "SLSS12.MYCOMP-INT.ORG", $Password, $RUN_LOGON_NETWORK, 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n', "\\PRINTSERVER\ITD0042", '/a', "\\pepeps007\printer_configs$\DATs\config.dat") temp.au3 Can anyone think of any other grammar rules that the /a needs to be surrounded by? Its not erroring out currently but its acting like it does not see the /a.
Nine Posted June 24, 2020 Posted June 24, 2020 Try this : RunAsWait ($Username, "SLSS12.MYCOMP-INT.ORG", $Password, $RUN_LOGON_NETWORK, _ 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n "\\PRINTSERVER\ITD0042" /a "\\pepeps007\printer_configs$\DATs\config.dat"') “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
slybry70 Posted June 27, 2020 Author Posted June 27, 2020 Sorry one more question. I am replacing the text in the line with variables. How would I format it if I got rid of the static line with variables like this? Its not working currently with added variables. I am sure its grammar once again. GetPrintServer() GetPrinterName() GetFileName() $Filepath = "\\" & $PrintServer & "\" & $PrinterNameString RunAsWait ($Username, "SLSS12.MYCOMP-INT.ORG", $Password, $RUN_LOGON_NETWORK, 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n $Filepath /a "\\pepeps007\printer_configs$\DATs\" & $FileNameString') The filepath is coming out correctly with MSGBOX so it should be going to the correct print server and printer like I had put it in as text but its not connecting with the printer when adding it as a variable. Output of Filepath: \\PRINTSERVER\ITD0042 which is correct. How would the grammar change when taking out the text and replacing with variables? Thank you!
ahmet Posted June 27, 2020 Posted June 27, 2020 Try following to see the output command ConsoleWrite('RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n $Filepath /a "\\pepeps007\printer_configs$\DATs\" & $FileNameString' & @CRLF) You can try this 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n ' & $Filepath & ' /a "\\pepeps007\printer_configs$\DATs\" ' & $FileNameString Notice the use of "&" to concatenate (combine) strings. More info can be found at Language Reference - Datatypes. Remember to print that to console to see if you get what you are expecting.
slybry70 Posted June 28, 2020 Author Posted June 28, 2020 TY. I was able to get it working like this. RunAsWait ($Username, "SLSS12.MYCOMP-INT.ORG", $Password, $RUN_LOGON_NETWORK, 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n' & $Filepath & ' /a ' & $FileNamePath & '') TY for the nudge in the right direction.
ahmet Posted June 28, 2020 Posted June 28, 2020 You are welcome. By the way it should work without last & '' It looks like as if you are adding a string of zero length.
Nine Posted June 28, 2020 Posted June 28, 2020 It will work I believe only if there is no blank inside the $Filepath and $FileNamePath. To ensure robustness, embed those 2 variables with double-quotes : RunAsWait ($Username, "SLSS12.MYCOMP-INT.ORG", $Password, $RUN_LOGON_NETWORK, 'RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n "' & $Filepath & '" /a "' & $FileNamePath & '"') “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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