none
I Need To Get AD Locations For A List of PC's RRS feed

  • General discussion

  • Hi All,

    I have a text file which has a list of 500 pcs, I need to get their location from AD, I'm looking for a simple powershell script to do this.

    Can anyone help

    Regards

    Stu

    • Changed type Bill_Stewart Tuesday, November 21, 2017 6:56 PM
    • Moved by Bill_Stewart Tuesday, November 21, 2017 6:56 PM This is not "scripts on demand"
    Tuesday, July 18, 2017 2:49 PM

All replies

  • Please read the following post first. It is right at the top of this forum.

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Tuesday, July 18, 2017 2:54 PM
  • Hi All,

    I have a text file which has a list of 500 pcs, I need to get their location from AD, I'm looking for a simple powershell script to do this.

    Can anyone help

    Regards

    Stu

    Hello Stewart.N

    you can do that:

    Import-Module *act*
    $pcs= Get-Content "Pcs-FileFullPath" # Such as c:\temp\pcs.txt

    foreach ($pc in $pcs)
    {
    $adPc = get-AdComputer $pc -Properties * 
    $adPc | select name, dist*

    }







    • Edited by asafgb Tuesday, July 18, 2017 3:26 PM
    Tuesday, July 18, 2017 3:25 PM
  • @asafgb Thanks

    @Bill Stewart * Sorry I would normally give it a so im just under the cosh to get something in place quick and a simple google search didn't help 8 Wont happen again Sorry.

    You may delete this post if you see fit.

    Regards

    Stewart

    Tuesday, July 18, 2017 4:19 PM
  • Understood; keep in mind that we are all pressed for time, and the respondents here are volunteers.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, July 18, 2017 4:23 PM