Configure printer from a remote pc using vbs and psexec

1.2k views Asked by At

I have a vbs file for configuring a network printer. Its stored in a remote pc..I need to run that vbs file from my pc. I have used psexec to remotely execute the file. I ran psexec using an admin account that's common to both machines. The printer is not getting configured even though there are no errors. But the same script works perfectly when directly executed in the remote PC. I even tried wmi & power shell coding.. Both r behaving similarly I.e. configuring printer only when running the script locally.. The vbs file makes use of the "AddWindowsPrinterConnection" to configure the printer. What could be the reason for the printer not getting configured?

1

There are 1 answers

0
Ansgar Wiechers On

If you want to run a script from a remote share on another remote computer, you need to run PsExec with explicit credentials:

psexec \\hostB -u username -p \\hostA\share\script.vbs

See this thread in the SysInternals forum.

In PowerShell you should be able to get around this issue via CredSSP.