Scripts Thread, Traversing directories and print files from the client over WebDav ? in Coding and Web Development; Hi All,
I'd like to know if it is possible Using Powershell 2.0 to traverse directory and print files on ...
-
21st September 2010, 06:11 AM #1
- Rep Power
- 7
Traversing directories and print files from the client over WebDav ?
Hi All,
I'd like to know if it is possible Using Powershell 2.0 to traverse directory and print files on the client side printer over WebDAV protocol ?
i got the below powershell script it works great over the shared network drive but how to actually modify and use it in WebDav folders ?
the scenario is like this: i have a directories in the server which has got multiple PDF files and the client would like to print it using the printer on their machine.
Thanks.
Last edited by albertwt; 21st September 2010 at 07:38 AM.
-
-
IDG Tech News
-
21st September 2010, 07:39 AM #2
- Rep Power
- 7
Printing script which works for shared network folder but not WebDAV
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
Script for testing the webdav protocol in use, it returns True
function Test-WebDav ()
{
param ( $Url = "$( throw 'URL parameter is required.')" )
$xhttp = New-Object -ComObject msxml2.xmlhttp
$xhttp.open("OPTIONS", $url, $false)
$xhttp.send()
if ( $xhttp.getResponseHeader("DAV") ) { $true }
else { $false }
}
Test-WebDav "http://vmws02.domain.com/"
-
SHARE:
Similar Threads
-
By DaveP in forum Downloads
Replies: 6
Last Post: 12th September 2011, 10:24 AM
-
By russdev in forum Windows
Replies: 0
Last Post: 29th June 2010, 10:51 AM
-
Replies: 11
Last Post: 6th May 2009, 11:07 PM
-
By LikesComputers in forum Windows
Replies: 4
Last Post: 25th June 2007, 01:33 PM
-
By Quackers in forum Web Development
Replies: 2
Last Post: 26th March 2006, 06:05 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules