(Powershell) Loop through get-aduser, export into SQL Database RRS feed

  • Question

  • Hello,

    I try to insert all Results from Get-Aduser into a SQL Table / Database

    I already did it with a variable, like $u = get-aduser... and so on -> which worked perfectly fine. 

    The Problem is that I have more then 500.000 Objects, which causes the effect that it takes very long until every Object is in the Variable.

    How can I process e.g. 1.000 Users, write them into a Data Table (SQL), empty the variable and then start with the next 1.000 Users until all 500.000 Objects are processed??

    I thought of something like Get-Aduser | foreach-Object { ... }  but I dont know how to continue then.

    Thank you in Advance
    Wednesday, May 13, 2020 7:45 PM

All replies