A défaut d'avoir obtenu une réponse
, je m'auto répond, voici la commande qui fonctionne:
1 2 3 4 5 6 7
|
import-module ac*
$date = (get-Date).tostring()
$month = (Get-Date).AddDays(-7)
$ADuserInmonth = Get-aduser -filter * -SearchBase OU=Utilisateurs,DC=COMMUN -Properties whencreated | where { $_.whenCreated -ge $month } | select name,whenCreated | out-file C:\Users\COMPTE\Desktop\cgsv.txt |
Par contre je n'arrive pas à envoyer le mail par powershell, la commande:
Send-MailMessage -From "@maild'envoi" -To "@mailderéception" -Subject "TEST" -SmtpServer "smtp.fr" -Body "TEST" -Attachments "C:\Users\COMPTE\Desktop\cgsv.txt"
La commande me renvoie un "Client does not have permissions to send as this sender". Avez vous une idée ?
Partager