Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 208927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:52:11+00:00 2026-05-11T17:52:11+00:00

In Active Directory, there is a tab called Dial-In, and under that tab is

  • 0

In Active Directory, there is a tab called “Dial-In”, and under that tab is a radio button control with three settings:

Allow Access
Deny Access
Control access through remote access policy

I’d like to write a VBScript to take a user name, and return the setting for that user.
(I’m actually modifying an existing VBScript, which is why I am forced to use that tool).

What is the best way to do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:52:11+00:00Added an answer on May 11, 2026 at 5:52 pm

    Here is the best solution I was able to come up with. It is easy to modify it to output the setting for all users.

    Main
    
    Function Main
      'Usage: cscript /nologo lookup.vbs mydomain username
      Wscript.Echo CanDialIn(Wscript.Arguments(0), Wscript.Arguments(1))
      Main = 0
    End Function
    
    Function CanDialIn(domainname, username)
      'Take a user name and query whether they have permission to Dial in or not
      'http://www.microsoft.com/technet/scriptcenter/resources/qanda/aug05/hey0825.mspx
      Const ADS_SCOPE_SUBTREE = 2
      Dim objConnection
      Dim objCommand
      Dim objRecordSet
    
      Set objConnection = CreateObject("ADODB.Connection")
      Set objCommand =   CreateObject("ADODB.Command")
      objConnection.Provider = "ADsDSOObject"
      objConnection.Open "Active Directory Provider"
      Set objCommand.ActiveConnection = objConnection
    
      objCommand.Properties("Page Size") = 1000
      objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
    
      'Three possible values for msNPAllowDialin:
      'TRUE = "Allow Access"
      'FALSE = "Deny Access"
      'EMPTY = "Control access through remote access policy"
      objCommand.CommandText = _
        "SELECT msNPAllowDialin FROM 'LDAP://dc=" & domainname & ",dc=com' WHERE objectCategory='user' AND sAMAccountName = '" & username & "'"
      On Error Resume Next
      Set objRecordSet = objCommand.Execute
      if objRecordSet.EOF then
        CanDialIn = "Could not find user " & username
      else
        if objRecordSet.Fields("msNPAllowDialin").Value = True then
          CanDialIn = "Allow"
        else
          if objRecordSet.Fields("msNPAllowDialin").Value = False then
            CanDialIn = "Deny"
          else
            CanDialIn = "Control"
          end if
        end if  
      end if
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've an Active Directory with domain myDomain.local , under it there exists a Distribution
Infrastructure has created an active directory account for me that has read access to
I have access to an Active Directory that enforces a 5 password history restriction.
Are there any libraries that can authenticate via active directory? This is a new
Are there any references to the Active Directory attributes that Outlook uses when viewing
Is there anyway to implement an repository that uses active directory (or any other
Are there examples which show how Delphi invokes the Active Directory Kerberos server to
Is there a way to connect my flex web application to Active Directory, and
Is there a simple way to resolve the Active Directory path of a Domain
I have an ASP.NET web site that will use Active Directory to store Users.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.