Using Powershell 2.0, can I navigate through directories and print files on a client printer?
I got below PowerShell script. It works great on a shared network drive, but how can I modify it and use it to request the contents of WebDav folders and then print only the .PDF file extension on the client side (and not on the server side)?
PowerShell script to navigate the directory:
function print-file($file) {
begin {
function internal-printfile($thefile) {
if ($thefile -is [string]) {
$filename = $thefile
}
else {
if ($thefile.FullName -is [string] ) {
$filename = $THEfile.FullName
}
}
$start = new-object System.Diagnostics.ProcessStartInfo $filename
$start.Verb = "print"
[System.Diagnostics.Process]::Start($start)
}
if ($file -ne $null) {
$filespecified = $true;
internal-printfile $file
}
}
process {
if (!$filespecified) {
write-Host process ; internal-printfile $_
}
}
}
dir *.pdf -r | print-file
source
share