Skip to content

AdaptiveTechnical/Fix-NLA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Fix-NLA

Sometimes, a network adapter is fully activated and Network Location Awareness (NLA) runs to determine the location, but network services are not yet fully available. This usually manifests as a network being listed as "Public" or "Private" instead of being recognized as the domain network. This can affect firewall configurations.

NLA used to be able to be restarted relatively easily. In modern Windows server OS releases, restarting NLA usually causes the service to hang. Therefore, this script handles the issue by restarting the network adapter, forcing NLA to run again.

This is designed to be run on server restart, for example by Task Scheduler.

Warning

This has the potential to render a server inaccessible if the network adapter isn't re-enabled successfully. Use with caution!

Usage

Test-InterfaceStatus.ps1
-MonitoredInterface "<interface-name>"
[-TargetState "DomainAuthenticated" | "Private" | "Public"]
[-ResolutionAction "Restart"]
[-RestartServices] [-ServicesList "<service-name>","<service-name>"]

Explanation

-MonitoredInterface
The name of the interface whose status is being monitored.

-TargetState
The name of the connection profile that should be active.
Defaults to "DomainAuthenticated" if not specified.

-ResolutionAction
The action that should be taken if the interface is not in the desired state.
Defaults to "Restart" if not specified.
(Currently, only "Restart" is supported.)

-RestartServices
Indicates the script should automatically restart the list of services if recovery actions were necessary.
This is useful for ensuring services can bind to appropriate interfaces after a state change.

-ServicesList
List of service names that should be restarted.
NOTE: These are service names, not display names!

About

Script to detect incorrect NLA and reset the network adapter if needed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published