extensionattribute6
hi,
i new powershell, know should possible :)
i have script email managers of , direct reports expire in 30 days (based on mike laughlins one) before script runs need check date in extension attribute 6. logic follows.
a new contractor starts , set account expirationdate 3 months today or contract end date if shorter
if contract 6 months put contract end date in extensionattribute6
what want @ top of script check there a value in extensionattribute6 , if there , >than account expirydate extend account expirydate 28 days or date in customattribute6 ever shortest todays date.
the issue due format of date (15/06/2014 dd/mm/yyyy), need change so:
#change get-aduser -identity auser -properties extensionattribute6 $date = get-date extensionattribute6 # $extatt = get-aduser -identity auser -properties extensionattribute6 $date = [datetime]::parseexact($extatt, "dd/mm/yyyy", $null)should convert date in extensionattribute6 property. assumes that property in format of day/month/year 2 digits day (dd), 2 digits month (mm) , 4 digits year (yyyy)
if find post has answered question, please mark answer. if find post helpful in anyway, please click vote helpful.
don't retire technet
Windows Server > Windows PowerShell
Comments
Post a Comment