Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

4
Enable and Set Account Expiry Date by .csv
Post Body

Hi guys

Fairly new to scripting. This should be fairly simple and i'm sure i've just not got my head around something properly. In this scenario, I have created a test user, disabled, with no account expiration date. The end goal is to take an OU of disabled users and re-enable them while adding an account expiration date. Here is my (not working) script so far...(my .csv headers are "samAccountName" and "Expiry" - can anyone assist?

Import-Module ActiveDirectory

Import-Csv "C:\Test290720.csv" | ForEach-Object {

$samAccountName = $_."samAccountName"

$Expiry = $_."DateTime"

Get-ADUser -Server "HCVZ306.edu.XXXXXXX.net" -Identity $samAccountName |

Set-ADAccountExpiration -DateTime $Expiry | Enable-ADAccount

}

Author
Account Strength
80%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
294
Link Karma
233
Comment Karma
61
Profile updated: 3 days ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago