Remote execution of rundll32 printui.dll printuiEntry using invoke-command is throwing problems RRS feed

  • Question

  • Hi guys,

     I am facing an issue while exporting and restoring the printer settings using rundll32 printui.dll method.

    The command is executing successfully with the resultant file while executing from local host. But when I am trying the same command using invoke-command for remote execution it is not throwing any resultant file(output is null).

    But the script is completing the execution without an Error.

    Please find the below ssample scripts for details :

    //Trying remotely from a localhost --- Not pulling the resultant file(test34.bin)

    $user = "username"
    $pwd = "password"

    $securePassword = ConvertTo-SecureString -String $pwd -AsPlainText -Force
    $creds = New-Object System.Management.Automation.PSCredential($user,$securePassword)
    Invoke-Command -ComputerName servername -Authentication default -credential $creds -ScriptBlock{
    rundll32 printui.dll,PrintUIEntry /Ss /n 'test' /a 'c:\samplesap\test34.bin' d u g

    //Trying directly in the server -- pulling the file(test34.bin) successfully

    rundll32 printui.dll,PrintUIEntry /Ss /n 'test' /a 'c:\samplesap\test34.bin' d u g

    But I need to execute the script from a centralized server only.

    Please help me with your findings

    Any helps will be greatly appreciated . .

    thanks in advance :)


    Thanks & Regards Automation Developer (@.!.@) ^

    • Edited by Developer here Monday, November 13, 2017 3:56 PM
    • Moved by Bill_Stewart Thursday, January 25, 2018 10:19 PM User should not be doing this
    Monday, November 13, 2017 3:55 PM

All replies

  • If you use the Print Manager application available on all versions of Windows server you would be able to avoid all of this.

    Without any error messages this will be hard to fix.  You need to capture the error code.  You should also use complete paths to the referenced files.

    All path references are remote paths.


    Monday, November 13, 2017 7:16 PM