About Me

My photo
HANUMANGARH, RAJASTHAN, India

Saturday, 18 June 2022

Set account expiration date from CSV

 create csv with below format:

Expire.csv

User,Expiration_date

User1,12-15-2015

User2,12-01-2015

User3,3-30-2015

User4,1-3-2016


use below script:


Import-Csv 'expire.csv' | ForEach-Object { Set-ADUser -Identity $_.User -AccountExpirationDate $([datetime]$_.Expiration_date) }

No comments:

Post a Comment

Extract Disk Info from Remote host

 # Define the remote hostname or IP address $remoteHost = Get-Content "C:\temp\RemoteServer.txt" # Define the output CSV file path...