Link to home
Start Free TrialLog in
Avatar of 7of9121098
7of9121098

asked on

How can I Print a PDF that is on a server in PowerShell?

I would like to know if I can print a pdf file that exists on a remote server? I would also like to append the user's credentials so I won't get a login prompt from the server.

Thanks.
Avatar of Dhiraj Mutha
Dhiraj Mutha
Flag of United States of America image

Avatar of 7of9121098
7of9121098

ASKER


 Hi pspgib, I used your example that suggested, but I still get prompted for a userId and password, I'm I missing something? I don't want to get a login window, just display the printer listing. thanks.

$username = "myusername"
$password = Get-Content c:\Temp\mypassword.txt | ConvertTo-SecureString

$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $password
$server= "ServerName"

Get-WMIObject Win32_Printer -ComputerName $server -credential $cred
(Get-Credential) | foreach-object{$_.Name}
ASKER CERTIFIED SOLUTION
Avatar of Dhiraj Mutha
Dhiraj Mutha
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.
Thanks for the grade.