PowerShell Runbook to notify users of Active Directory password expiration

This is a PowerShell Runbook (script) to notify users of Active Directory password expiration. It was created to run using an Azure Hybrid Automation Worker, but you can run this as a scheduled task, or using other scheduling engines. I am not sure why you wouldnt want to use Azu

 
 
 
 
 
(0)
565 times
Add to favorites
Active Directory
10/6/2018
E-mail Twitter del.icio.us Digg Facebook
  • SMTPServer
    1 Posts | Last post June 03, 2019
    • Hola, estoy usando tu script y he hecho las siguientes modificaciones:
      
      	# Specify the email address of the sender
      	[Parameter(Mandatory=$false,HelpMessage="notifications@prueba.sa")]
      	[String]$FromEmailAddress = 'notificaciones@prueba.sa',
      
      	# Specify the count of days to begin notification
      	[Parameter(Mandatory=$false,HelpMessage="15")]
      	[Int]$PasswordNotificationStartInDays = '15',
      
      	# Specify the OU search base where the users are located
      	[Parameter(Mandatory=$false,HelpMessage='OU=Usuarios,DC=PRUEBA, DC=COM')]
          [String]$OUSearchBase = 'OU=Usuarios, DC=PRUEBA, DC=COM'
      )
      
      # Get SMTP Server from Automation Account Variable
      #$SMTPServer = Get-AutomationVariable -Name 'SMTP Server'
      $SMTPServer = '127.0.0.1'
      
      
      tengo instalada la caracteristica de servidor SMTP en el servidor de dominio W2016.
      
      y pongo en el código que el ServerSMTP es la IP del dominio. ('127.0.0.1')
      
      No sale ningún error al ejecutar el script, PERO no llegan los correos. 
      
      
      PS C:\Users\Administrador> C:\Users\Administrador\Desktop\Invoke-UserPasswordExpirationNotification.ps1
      User A B C password expires in 4 days, Sending email
      Users Email is a.pm2011@gmail.com
      Password Expires on 06/08/2019 12:12:34
      User C D E has never logged on.
      Script complete
      
      Agradezco tu ayuda