• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 360
  • Last Modified:

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.
0
7of9121098
Asked:
7of9121098
  • 3
  • 2
1 Solution
 
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
 
Dhiraj MuthaCommented:
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:
Thanks.
0
 
Dhiraj MuthaCommented:
Thanks for the grade.
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now