by underoath23 at 2013-01-04 09:04:20
I am new to powershell. I am wondering how I would go about running a script that will insert the current date into the description field in AD for a User.by underoath23 at 2013-01-04 09:35:06
Any guidance would be greatly appreciated.
Cheers
I should clarify that I know how to edit the description, just not how to place the current date in there instead of text I specify each time. I also would like to be able to run this script by using the samname as the parameter.by underoath23 at 2013-01-04 10:08:51
ok, I figured part of it out. For anyone who may want to know, I used: {description=Get-Date -Format u} using the set-qaduser cmdletby BChambs at 2013-01-08 13:01:18
[quote="underoath23"]ok, I figured part of it out. For anyone who may want to know, I used: {description=Get-Date -Format u} using the set-qaduser cmdlet[/quote]by Slashj at 2013-02-21 06:17:06
This will return a more simple date, if desired:
$description = Get-Date -Format ‘MM/dd/yyyy’
Param(
[Parameter(Mandatory=$true)]
[String]$samaccountname
)
$date = Get-date -Format ‘MM/dd/yyyy’
Get-qaduser $samaccountname | set-Qaduser -description $date
---------
You should now be able to run this script like this in PoSh:
PathtoScript\Scriptname.ps1 -samaccountname Insertsamaccountname