有沒有辦法在Windows Server 2008 R2中查詢可以存取VPN連線的使用者列表

有沒有辦法在Windows Server 2008 R2中查詢可以存取VPN連線的使用者列表

我想知道是否可以查詢(powershell、ADUC 等)並產生能夠登入 Windows Server 2008 R2 上運行的 VPN 伺服器的使用者清單?

控制給定使用者連接到 VPN 的能力的主要因素是否僅取決於「撥入」標籤上的設定?

編輯

對於 Techie007,這是錯誤輸出

 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

上面的輸出被一遍又一遍地列印出來,然後它將列印一個用戶名,然後再次顯示錯誤,然後列印另一個用戶名,然後再次顯示錯誤。知道為什麼要這樣做嗎?

答案1

控制給定使用者連接到 VPN 的能力的主要因素是否僅取決於「撥入」標籤上的設定?

是的,您可以使用 PowerShell(在網域控制器上執行)來取得它,如下所示:

$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
    }
}

或者,您可以使用以下命令從命令提示字元(在網域控制器上執行)取得它dsquery

dsquery * -Filter "(&(objectCategory=person)(objectClass=user)(msNPAllowDialin=TRUE))"

相關內容