This repository was archived by the owner on Sep 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpowershell.ps1
More file actions
27 lines (23 loc) · 1.36 KB
/
powershell.ps1
File metadata and controls
27 lines (23 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"Automated QC program. Window will close automatically when finshed"
"For details contact: Christopher Hall, ch15@sanger.ac.uk"
& "C:\Users\Operator\Documents\R\R-3.6.0\bin\Rscript.exe" "D:\BDQC\QCscript v6.R"
$username = ""
$password = ""
$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
[array]$toattach = Get-ChildItem "D:\BDQC\Images" *.png
$From = ""
$To = ""
$Attachment = $toattach.fullname
$Subject = "FT1 sample quality report: 10% threshold"
$Body = Get-Content -Path D:\BDQC\Summaries\tosend.txt -Raw
$SMTPServer = "smtp.gmail.com"
$SMTPPort = "587"
if($Attachment) {
Send-MailMessage -From $From -to $To -Subject $Subject -Body $Body -BodyAsHtml -SmtpServer $SMTPServer -port $SMTPPort -UseSsl -Credential $cred -Attachments $Attachment -DeliveryNotificationOption OnSuccess
} else {
Send-MailMessage -From $From -to $To -Subject $Subject -Body $Body -BodyAsHtml -SmtpServer $SMTPServer -port $SMTPPort -UseSsl -Credential $cred -DeliveryNotificationOption OnSuccess
}
New-Item -ItemType Directory -Path "D:\BDQC\Archive\$((Get-Date).ToString('yyyy-MM-dd'))"
Move-Item -Path D:\BDQC\Images\*.png -Destination D:\BDQC\Archive\$((Get-Date).ToString('yyyy-MM-dd'))