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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 240k
  • Answers 240k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Looks like you're missed the BEGIN. May 13, 2026 at 7:12 am
  • Editorial Team
    Editorial Team added an answer With scoped-proxies, Spring still needs to know the type of… May 13, 2026 at 7:12 am
  • Editorial Team
    Editorial Team added an answer It won't compile because of 'GOTO block' instead of 'goto… May 13, 2026 at 7:12 am

Related Questions

I need to implement Integrated Windows Authentication for a WCF service hosted on IIS
This question is active at https://serverfault.com/questions/67844/renew-a-ssl-cert-on-iis6 . Thanks. My manager ordered a new wild
I'm working on a server-side project that consists of several services. Each service is
How do you look up a user in Active Directory? Some example usernames are:

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.