none
How do I find nearest file server from an active directory forest? RRS feed

  • Question

  • Hi

    I am trying to copy sources to a workstation from file servers or simply member servers within the forest? The requirement  is workstation must choose sources from nearest server/file server. Mention of that files server has replication in place, meaning if we copy files in a file server that will be synced with all other file server.

    I am trying to write script to choose the nearest file server to copy files to a certain workstation. What options we have other than ping response to determine closer vicinity. I am trying to say, if we have the list of file servers and based on their sites and subnets should we be able to find nearest server. If feasible what would be the scripting way of doing it.

    Thanks

    Raf  

    • Moved by Bill_Stewart Wednesday, November 29, 2017 6:22 PM Not a scripting question
    Tuesday, October 3, 2017 10:02 AM

All replies

  • Thanks jrv

    I consider it is scripting question. 

    Do we have any batch or powershell command that finds nearest server. All servers/hosts are within the AD forest.

    Wednesday, October 4, 2017 4:59 AM
  • check following link, hope it helps

    https://gallery.technet.microsoft.com/scriptcenter/Powershell-script-to-get-39c73c74

    NTRao

    Wednesday, October 4, 2017 6:57 AM
  • Thanks jrv

    I consider it is scripting question. 

    Do we have any batch or powershell command that finds nearest server. All servers/hosts are within the AD forest.

    Unfortunately there is no such concept as "nearest" in networking. You can search by subnet or by organization but that does not tell you how far away a server is. Also the idea of any nearest server has no technical meaning.

    Windows AD has a concept called "location awareness" but it has to be enabled and configured and all devices need to have their location assigned.  If this has been set up then you can search by location assuming location is geographical and not logical.

    You can also search by site and subnet if this has been configured into AD.  That is what the Sites & Subnets AD console is for but many untrained Admins never set this up.

    Once these things are set up then we can use simple PS Net classes to search by site/subnet for resources like file servers and printers.

    No dearest, there is no such thing as nearest in the computer world.  'Current subnet" or "current site" or, with location awareness we can even define buildings, floors and sections of floors which is valuable for finding printers that are close to a particular workstation.


    \_(ツ)_/

    Wednesday, October 4, 2017 10:16 AM
  • Here is the location setting in AD for a computer:

    ADSI queries can include location in the query.


    \_(ツ)_/

    Wednesday, October 4, 2017 10:23 AM
  • Here is the ADSS screen that lets you define your network.

    The properties of sites define location and that is a path component that can be used to find all objects in a site or subnet.


    \_(ツ)_/


    • Edited by jrv Wednesday, October 4, 2017 10:29 AM
    Wednesday, October 4, 2017 10:27 AM
  • For assistance with setting up location in AD post in the Directory Services forum or search the MS docs for the instructions.

    Here is the command to get the site and location:

    [System.DirectoryServices.ActiveDirectory.ActiveDirectorySite]::GetComputerSite()

    You can use "Location" t retrieve all servers that have the File Server role and that match the site.


    \_(ツ)_/


    • Edited by jrv Wednesday, October 4, 2017 10:39 AM
    Wednesday, October 4, 2017 10:38 AM
  • I should also note another way to create location and the concept of "nearness' and that is to place workstaions in a group that is named for the file server they are assigned to.  You can use a naming comvention for the groups so that it can be extracted at the workstation such as.

    Group name = FSR-Philadelphia.

    Add all workstation's in that location to the group.  Now just get the "memberOf" for the computer object and search for group name "-LIKE 'FSR-*'" and you will have the name of the assigned file server.

    I prefer using location as it is more abstract and can be used in more ways from code.  It also allows the AD Browser app to show the user resources that are "near" his location since the AD browser is location aware when this has been configured.


    \_(ツ)_/

    Wednesday, October 4, 2017 10:55 AM
  • Hi JRV

    I am not sure about nearest networking concept reference. But We can see various availability zones in public cloud like AWS. We are advised to choose nearest zone while creating instances for faster access.

    Also, there are CDNs on the basis of geographical locations

    Do we really consider that ping response from a host installed in London, to two servers, one located in London, and other in US would be same?

    Tuesday, October 10, 2017 9:41 AM
  • If you are asking about AWS then you must post in AWS forum for assistance.  This is Microsoft and not Amazon.


    \_(ツ)_/

    Tuesday, October 10, 2017 10:04 AM
  • This was also in my mind, unfortunately sys admins do not manage ADSS properly. sorry!!
    Tuesday, October 10, 2017 10:05 AM
  • We can't help you with AWS issues.

    \_(ツ)_/

    Tuesday, October 10, 2017 10:06 AM
  • Hi JRV

    I am not sure about nearest networking concept reference. But We can see various availability zones in public cloud like AWS. We are advised to choose nearest zone while creating instances for faster access.

    Also, there are CDNs on the basis of geographical locations

    Do we really consider that ping response from a host installed in London, to two servers, one located in London, and other in US would be same?

    Hi Raofu09

    In AWS Zones are pre defined with specific names, so that we can able to identify easily, in the same way you can also give the specif name,  where user can easily identify nearest host, hope this make sense.

    NTRao

    Tuesday, October 10, 2017 10:26 AM