|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
You can use PowerShell Cmdlets for Active Directory
from here http://www.quest.com/2_0/default.asp...estdefid=13255 and the following script ######################################33 $Excel = New-Object -com "Excel.Application" $WorkBook = $Excel.Workbooks.Open("C:\work\1.xls") $Sheet = $WorkBook.Worksheets.Item("Sheet1") $OU = "domain.com/enterprise/division/users" $Date = Date $Date.AddDays(-7) > $Null $Users = Get-QADUser -SearchRoot $OU -SearchScope subtree -includeallproperties $n = 1 foreach ($User in $Users) { if ($User.creationdate -gt ([datetime]$Date)) { $Sheet.Cells.Item($n,1).Value2 = $user.displayname $Sheet.Cells.Item($n,2).Value2 = $user.creationdate $Sheet.Cells.Item($n,3).Value2 = $user.homedirectory $Sheet.Cells.Item($n,4).Value2 = $user.profilepath $n++ } } $WorkBook.Save() $WorkBook.Close() $Excel.Quit() Andrew "Wizzy" wrote: > Hi, > > I would like to know how to get a list of xp accts created in an OU in past > 7 days along with their creation date, home drive path & profile path. I > would like the output of the script to be directed to an excel file with each > type of attribute in different coumns. Kindly advise!! > -- > Regards, > Wizzy |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
And, as an aside, these are not XP accounts, but Active Directory Accounts.
/Al "Andrew Karmadanov" <Andrew Karmadanov@discussions.microsoft.com> wrote in message news:295EFE54-EF08-4C13-A835-CE722050B5B0@microsoft.com... > You can use PowerShell Cmdlets for Active Directory > from here > http://www.quest.com/2_0/default.asp...estdefid=13255 > > and the following script > > ######################################33 > $Excel = New-Object -com "Excel.Application" > $WorkBook = $Excel.Workbooks.Open("C:\work\1.xls") > $Sheet = $WorkBook.Worksheets.Item("Sheet1") > > $OU = "domain.com/enterprise/division/users" > $Date = Date > $Date.AddDays(-7) > $Null > > $Users = Get-QADUser -SearchRoot $OU -SearchScope subtree > -includeallproperties > > $n = 1 > foreach ($User in $Users) > { > if ($User.creationdate -gt ([datetime]$Date)) > { > $Sheet.Cells.Item($n,1).Value2 = $user.displayname > $Sheet.Cells.Item($n,2).Value2 = $user.creationdate > $Sheet.Cells.Item($n,3).Value2 = $user.homedirectory > $Sheet.Cells.Item($n,4).Value2 = $user.profilepath > $n++ > } > } > > > $WorkBook.Save() > $WorkBook.Close() > $Excel.Quit() > > Andrew > > "Wizzy" wrote: > >> Hi, >> >> I would like to know how to get a list of xp accts created in an OU in >> past >> 7 days along with their creation date, home drive path & profile path. I >> would like the output of the script to be directed to an excel file with >> each >> type of attribute in different coumns. Kindly advise!! >> -- >> Regards, >> Wizzy |
|
![]() |
| Outils de la discussion | |
|
|