SSRS - Rendering to PDF and reupload - powershell

is it possible to render/save a SSRS report as a PDF and upload the PDF-file on the server in a second step? I would prefer Powershell webservices?
Thank you in advance.

You are not showing your code, or what you've even searched for. Folks here don't like it when you don't show any effort, and will quickly downvote your post or vote to close and point you here: https://stackoverflow.com/help/how-to-ask. Closing by telling you that StackOverflow is not a free script writing service.
However, since you are very new here, I'll provide you this, this time.
I am not sure what this is... 'Powershell webservices', but maybe you meant PowerShell Web Access, and if so, that is not what it is for. Saving output to PDF using PowerShell is a real common thing, and well documented all over the web and that just requires a simple search for that content/samples:
See the PowerShell cmdlet
Out-Printer
Just choose a PDF printer installed on the target.
Sending PowerShell Results to PDF (Part 1 - 3)
https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/sending-powershell-results-to-pdf-part-1
https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/sending-powershell-results-to-pdf-part-2
https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/sending-powershell-results-to-pdf-part-3
The author provides samples in each post listed...
Snippet from part 3:
function Out-PDFFile
{
param
(
$Path = "$env:temp\results.pdf",
[Switch]
$Open
)
...
}
Creating PDF files using PowerShell
Sometimes, you may want your scripts to produce output for management
in a format other than plain text or Excel files (CSV). Thanks to
various .NET PDF creation libraries, it is relatively simple to create
PDF reports using PowerShell.
Directly from Microsoft Docs site.
Automate SSRS Report Generation using PowerShell
This blog post is tested on SQL Server 2014 and PowerShell V5.
...
In this blog post I will focus on generating PDF reports via scripting. Let's tackle this piece by piece first, and we'll put
everything in a nice little script at the end of the post.
...
As far as uploading files, that is what the PowerShell web cmdlets are for.
Invoke-WebRequest
Invoke-RestMethod
or the native .Net namespace
WebClient.UploadFile Method
... so as for this... 'Powershell webservices', I am going to assume this is what you meant.

Related

Powershell to add text to homepage of SP2013 sites

I'm in desperate need of your help on creating a powershell script to add text to a SP2013 sites that we're migrating content from. I'd essentially like to add a banner that says 'site is now locked and no longer in use' to site homepages.
I found this article but it's dated as it uses snappin which I understand is no longer supported and superseded by PnP. Any help on how to convert this to a PnP or other supported powershell?
https://www.c-sharpcorner.com/blogs/add-content-editor-web-part-on-the-sharepoint-2013-sites-using-powershell
I will be getting site URls from a csv list which I can script but it's cadding text content webpage on homepages if what I can't seem to do?

Powershell method of downloading file from a website with a changing URL?

I have been given a task that involves downloading a single file every day from a website. Let's call it "https://test.example.com". I have credentials that allow me to login to the site, where a Flash interface then presents the files that are available for download. After the file is downloaded, it is then processed in a variety of ways. I have already put together the Powershell that handles all that, I am just having a hard time with automating the actual download of the file.
I used the Flash interface to download a few files while watching the network activity, and found that it is actually pulling the file from this URL:
https://test.example.com/link/EBDB7F67EF3B28XX99NCAD9920160423/file.zip
Therefore, I was able to put this together in order to automatically get the file via my PS script:
$url = 'https://test.example.com/link/EBDB7F67EF3B28XX99NCAD9920160423/file.zip'
$output = "C:\Downloads\file.zip"
Invoke-WebRequest -Uri $url -OutFile $output
However, the long string of numbers in the URL changes every day. The only discernible pattern I can find is that the last eight digits are always the date on which that particular file is posted.
Is there a good way to approach this? I've been experimenting with wildcards and patterns, as well as checking the HTML for elements that I can filter, but I am having a hard time finding the correct solution.
This is very hard to automate. You can't drive Flash from the script unless it is specifically designed for that. As I see it now your only options are:
Contact site devs if possible, maybe they can give you a details on function that generates link. This gives me an idea - perhaps you can reverse engineer Flash code to find that function details yourself. Use flash decompiler for this.
Simulate the user browsing the flash site. This can be done in one of the following ways:
Autohotkey - you can record mouse clicking relative to the browser window and execute the script again. Unless flash interface is too dynamic and unpredictive it will work.
Sikuli - another automation language which relies on picture segment recognition.
All above 2.* methods produce fragile automation code as they depend on browser settings (zoom, theme) and even OS settings. For this reason you need to dedicate one machine for that in all probability (virtual machine ofc). Decompiling flash code and re-implementing the url generting code in powershell will make it a reliable 100%.
As somebody said in comments this is not a powershell queestion but browser automation question.

Building an automated script to copy a page of text, translate it in Google Translator and paste it in Word

So, as the title says, I would like to make an automated script that is going to take all the text from one PDF page, copy it, paste it into Google Translate and then copy the translated text into another Microsoft Word document.
Since that PDF has a lot of pages (150+), I thought it may be easier to make an automated script to do that.
What language would I have to use, would it be complicated for me to do it and in the end, will I actually save time by using this script (implying that I have to learn it first, but I have some programming experience (I know C++, Javascript, PHP), but I do not have a strong grasp of algorithms (like Flood Fill, ...))?
Thanks in advance!
EDIT : I found that I could use AutoIt for scripting... but I don't know would I be better off using AutoIt or Powershell... I also want to learn something that would be enable me to create other scripts (for example to automate some processes I do in Camtasia Studio)... So, AutoIt or Powershell?
As an AutoIt user I would say AutoIt.
Copying text out of PDFs is not quite as simple as you might imagine. Mileage will vary on how the PDF was created, and there are several methods you can use:
Most PDFs will have most of the text in the file itself, allowing you to get the text using a simple method like this
This method uses zlib to do something to the pdf. Not sure what as I've never tried it.
There are a variety of examples of using third party programs to do this, which may be better. There is one using Debenu and another using XPDF
Automating other programs such as acrobat should be possible, in acrobats case they have an api that can be used, though I'm not aware of this already being wrapped in AutoIt.
As to the rest of the requirements, there is a UDF to translate with google translate here, and the word UDF is a standard one that comes with the AutoIt installation.

Automate Outlook first time opening

I wanted to configure a script that would basically take the opening Outlook 2010 for the first time dialog and accept the defaults. We have an exchange server that is currently running that populates the first time fields with the user's AD information. Basically I wanted to write a script in powershell that would accept the default values that AD has filled in and complete the install. Once the install is complete Outlook will set up a copy of the user's mailbox and all of their mail will be pulled down to the computer.
I have been trying and trying in powershell to accomplish the acceptance of defaults to no avail. Is there any possible way to link a powershell script with outlook and have it accept GUI dialogs?
I have not written any code to do this other than a little initialization script in powershell. I am also a powershell newbie so I know enough to create a com object and call that object so that it can open Outlook but that is as far as I can go.
Can someone please give me some help? Here is what I have but it really doesn't work that well:
$mail = new-object -com Outlook.Application
$namespace = $mail.GetNamespace("MAPI")
$folder = $namespace.GetDefaultFolder("olFolderInbox")
$explorer = $folder.GetExplorer()
$explorer.Display()
I'm not sure how far you've gotten with PowerShell, but review this link.
Consider other Windows GUI scripting engines, they should solve this problem pretty easily - more easily than PowerShell scripting.
Try:
AutoHotkey
AutoIt
I ended up using the WASP snap-in at http://wasp.codeplex.com/. It allows UI automation by finding widows and sending commands to those windows. It is easy to use and makes tasks like mine a lot easier. It is only a 32 bit .dll but it works for Powershell >= 2.0. Thank you all for your helpful comments.

Can Crystal Reports generate documents in PDF/A file format?

We are looking for a solution to generate documents in PDF/A format for sharing and also archiving purpose.
I checked the description of ExportFormatType.PortableDocFormat, however it just say PDF file.
Can the Crystal Reports generate PDF/A compatible files?
I don't think you export directly to PDF/A. Instead, I recommend using Crystal to export to PDF, then find a third-party software to convert your PDF to PDF/A. It takes 1 extra step, but it will meet your needs.
I googled a bit and found http://www.abbyyusa.com/shop/pdftransformer/. I know nothing about this software, I'm just presenting it as an example. It costs 80USD, but you might be able to find a freeware alternative.
http://www.pdfa.org/doku.php is the offical homepage of PDF/A. You might find something useful there too.
According to this SAP community thread from a few days ago, it can't be done natively, although there was a third-party component mentioned there. I haven't tried it, so I have no idea if it works or not.