I put together the following script to help out someone on the internets, the requirement was to print all documents in a SP library. This PowerShell iterates through a library (folders included), downloads a local copy, then prints to the default printer on the machine it is executed on.
Swap $destination, $webURL and $listUrl parameters as needed.
Fun for the whole family and keeping our paper mill workers gainfully employed!
######################## Start Variables ######################## $destination = "C:" $webUrl = "https://mysharepoint/sites/sitename/" $listUrl = "https://mysharepoint/sites/sitename/Shared%20Documents/" ############################################################## $web = Get-SPWeb -Identity $webUrl $list = $web.GetList($listUrl) function ProcessFolder { param($folderUrl) $folder = $web.GetFolder($folderUrl) foreach ($file in $folder.Files) { #Ensure destination directory $destinationfolder = $destination + "/" + $folder.Url if (!(Test-Path -path $destinationfolder)) { $dest = New-Item $destinationfolder -type directory } #Download file $binary = $file.OpenBinary() $stream = New-Object System.IO.FileStream($destinationfolder + "/" + $file.Name), Create $writer = New-Object System.IO.BinaryWriter($stream) $writer.write($binary) $writer.Close() Start-Process -FilePath ($destinationfolder + "/" + $file.Name) -Verb Print } } #Download root files ProcessFolder($list.RootFolder.Url) #Download files in folders foreach ($folder in $list.Folders) { ProcessFolder($folder.Url) }