I have a folder that has weekly reports. Each report has the date of creation in the name example "report-A_2_05_19.pdf", "report-B_2_05_19.pdf", etc. I would like to create variables for these but since the date changes in the name of the reports each week I was trying to do this:
$rA = "c:\reports\report-A*.pdf"
$rb = "C:\reports\report-B*.pdf
When I do this and try to open the report using the wild cards it just prints to the screen:
c:\reports\report-A*.pdf
$pw = Get-Content C:\MailPW.txt | ConvertTo-SecureString
$cred = New-Object System.Management.Automation.PSCredential [email protected], $pw
Send-MailMessage -To [email protected] -from [email protected] -Subject "Attachments" -Body "Attachments." -attachments $rA, $rB -Smtpserver mail.domain.com -UseSsl -credential $cred
$rAand$rb