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.
7of9121098Asked:
Who is Participating?
 
Dhiraj MuthaLevel DCommented:
Try this:

http://technet.microsoft.com/en-us/magazine/ff714574.aspx


In the script that you want to run automatically, add the following commands:
$password = Get-Content c:\temp\password.txt | ConvertTo-SecureString
$credential = New-Object System.Management.Automation.PSCredential "CachedUser",$password
0
 
7of9121098Author Commented:

 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}
0
 
7of9121098Author Commented:
Thanks.
0
 
Dhiraj MuthaLevel DCommented:
Thanks for the grade.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.