Forum Discussion
ezflow
Oct 07, 2022Copper Contributor
Get Current Month and Time
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 wa...
LainRobertson
Oct 07, 2022Silver Contributor
$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