In this blog post, we will walk through a simple PowerShell script that allows you to set an account expiration date for a user in Active Directory. The Script Here is the PowerShell script: # Prompt the user to enter the username $username = Read-Host "Enter the username:" # Prompt the user to enter the account expiration date in the specified format $dateString = Read-Host "Enter the account expiration date in the format 'MM/dd/yyyy hh:mm AM/PM':" # Convert the user input into a DateTime object using the ParseExact method $time = [ DateTime ]::ParseExact( $dateString , "MM/dd/yyyy hh:mm tt" , $null ) # Get the AD user object for the specified username and retrieve the AccountExpirationDate property $user = Get-ADUser -Identity $username -Properties "AccountExpirationDate" # Set the AccountExpirationDate property of the user account to the specified date and time $user .AccountExpirationDate = $time # Update the...