Oct 07 2022 07:22 AM
Hi,
We are automating user creation in the AD (on Prem). For the password field we want the following
to be capture in powershell in the following formatt: Month@HourMinunte or October@945
I want to pass it as a variable and not hardcoded
$dstPassword = "October@945 " | ConvertTo-SecureString
Oct 07 2022 08:00 AM
$Months = @("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$Timestamp = [datetime]::UtcNow;
$dstPassword = "$($Months[$Timestamp.Month - 1])@$($Timestamp.ToString('hmm'))" | ConvertTo-SecureString -AsPlainText -Force;
Cheers,
Lain
Oct 10 2022 12:18 AM