Synching Microsoft NPS (RADIUS) servers

Abstract

In this post we'll see a short PowerShell script to synch remote Microsoft NPS (RADIUS) server configuration. I'm not the author of the script, but I think it could be useful for others.

How it works

The script should be self-explanatory, but here a short description about how it works:

  1. Backup the local NPS configuration.
  2. Retrieve all available NPS servers.
  3. Backup each remote NPS server and push to it the configuration.

The script

Export-NpsConfiguration -Path C:\TEMP\LocalNPSExportedConfig.xml

$CurrentServerNPS = $env:computername

$NPServers = Get-ADGroupMember "RAS and IAS Servers"
$NPServers | ForEach-Object {

	$NPServerName = $_.Name

	if ($NPServerName -ne $CurrentServerNPS) {
		$NPServerName
		copy-item Export-NpsConfiguration -Path  \\$NPServerName\C$\TEMP\LocalNPSExportedConfig.xml
		Invoke-Command -ComputerName $NPServerName -ScriptBlock {Export-NPSConfiguration -Path C:\TEMP\BackupNPSExportedConfig.xml
		Invoke-Command -ComputerName $NPServerName -ScriptBlock {Import-NPSConfiguration -Path C:\TEMP\LocalNPSExportedConfig.xml
	}
}

References

Posted on 04 Jul 2016 by Andrea.
  • Gmail icon
  • Twitter icon
  • Facebook icon
  • LinkedIN icon
  • Google+ icon