I have a Excel sheet having the details of mail ID, mail subject and mail content. I need to write a power-shell script. When it is ran, mails have to be sent to mail IDs present in the Excel sheet with the corresponding mail subject and content. Help me in writing a power-shell script. Even a ready-made code would be appreciable.
TIA
Well, I think that you should have at least something. This is not the place where you will find someone who will write you the whole script.
to check the code and help you, yes, but not to write from scratch.
I would search on github for already written scripts, or Microsoft Technet Gallery: Microsoft Technet Gallery
To search the Excel file, first you could use Get-Content, and then use a Select-Object cmdlet to select the values you want.
After you find what you need, you can use Send-MailMessage cmdlet to send an email to recipient.
Related
we have to export users data like name, mobile number, title etc. from outlook application Address Book (From 2 Global address list Group) by using power shell script or batch file, to output file might be a CSV or text or excel. please help me any one by providing required power shell script to solve this problem.
thanks
You can automate Outlook from PowerShell to export contacts. See Outlook Email Automation with PowerShell to get started quickly.
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.
I am new to powershell and need some help. I have a code which runs everyday and sends an email out to people regarding the server status and other details. What i need to do is save that file as maybe an output file or something so if the customer wants can go in to powershell type in the script command and it comes up with the information thats on the email
Is there a way to do this. This cant be a text file. Has to be something u can type and the data comes up?
please help, thanks in advance
Os
Without code the only definite answer I can give you is using the Out-File command. I do not see why it can't be a txt file (because it's just an email)since data can come up and be typed. You can always Out-File to excel or csv, it really all depends on what you're trying to ask.
Does anyone know if it it possible to move a received email with attachments, other than .pdf, ex. .txt files to antoher folder than the inbox in Outlook 2010?
I can't find something about "sort by attchement" via powershell.
I hope some of you have some inputs.
I had to do a similar task recently and learnt from this tutorial, which includes a script you can download to modify for your needs:
http://gsexdev.blogspot.com/2010/01/writing-simple-scripted-process-to.html
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.