So in my environment we have to add NPS RADIUS clients on a somewhat regular basis. They come in sporadically one at a time, so there's no big list to work from and loop through.
This code is very rudimentary, but it works:
# Load the Shared Secret into a variable
$SharedSecret = Get-NpsSharedSecretTemplate -Name "xCorrectName"
# Get client name and IP address
$NPSClientName = Read-Host -Prompt 'Input NPS Client Friendly Name:'
$NPSClientAddress = Read-Host -Prompt 'Input NPS Client IP Address:'
# Add the client to NPS
New-NpsRadiusClient -Name $NPSClientName -Address $NPSClientAddress -SharedSecret $SharedSecret.SharedSecret
The trouble is that what I'd really like it to do is apply the shared secret template that we have, not just the shared secret value. In the properties window of the newly-created client entry, the shared secret template pull-down is "None." We like the ability to change a template and have that change applied to the entire (rather large) environment.**
I've read and read and cannot find a way of doing this; it will only apply the shared secret value, not the actual template. Any ideas?
Thank you for your help,
** I know Set-NpsRadiusClient will change the value of all the entries at once, but the "must use template" paradigm is one I'm not going to be able to convince my management to move away from.