I was wondering if it is possible to query (powershell, ADUC, etc) and generate a list of users who are able to login to a VPN server running on Windows Server 2008 R2?
Is the main thing that controls the ability to connect to VPN for a given user just depend on the settings on the Dial In tab?
Edit
For Techie007, here is the error output
Select-Object : Cannot process argument because the value of argument "obj" is null. Change the value of argument "obj" to a non-null value. At C:\Users\itsupport\function.ps1:5 char:58 + $dialin = Get-ADUser $username -Properties * | select <<<< -ExpandProper ty msNPAllowDialin + CategoryInfo : InvalidArgument: (:) [Select-Object], PSArgument NullException + FullyQualifiedErrorId : ArgumentNull,Microsoft.PowerShell.Commands.Selec tObjectCommand The above output gets printed out over and over and over, and then it will print a single username, and then show the error again, and then print another username, and then show the error again. Any idea as to why it is doing that?
1 Answer
Is the main thing that controls the ability to connect to VPN for a given user just depend on the settings on the Dial In tab?
Yes, and you can get it with PowerShell (run on a domain controller) like this:
$usernames = Get-ADUser -Filter * | select -ExpandProperty SamAccountName foreach ($username in $usernames) { $dialin = Get-ADUser $username -Properties * | select -ExpandProperty msNPAllowDialin if ($dialin -eq "True") { Write-Output $username } } Alternatively, you can get it from a command-prompt (run on a domain controller) using dsquery:
dsquery * -Filter "(&(objectCategory=person)(objectClass=user)(msNPAllowDialin=TRUE))" 6