Announcement

Collapse
No announcement yet.

VB Script pull dial in tab propery

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VB Script pull dial in tab propery

    hi all,
    I wrote a vb script to pull dial in tab propery from my windows 2003 std ad server, looks the

    objUser.Get("msNPAllowDialin") is not working properly, all user get "access allow", and this is not true!
    anyone has idea?
    thanks in advance!

    jimmy


    Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D


    blnMsNPAllowDialin = objUser.Get("msNPAllowDialin")
    'WScript.Echo "Remote Access Permission (Dial-in or VPN)"
    If Err.Number = E_ADS_PROPERTY_NOT_FOUND Then
    'WScript.Echo "Control access through Remote Access Policy"
    objExcel.Cells(x, 2).Value = "Control access through Remote Access Policy"
    Err.Clear
    Else
    If blnMsNPAllowDialin = True Then
    'WScript.Echo "Allow access (msNPAllowDialin)"
    objExcel.Cells(x, 2).Value = "Allow access"
    Else
    'WScript.Echo "Deny access (msNPAllowDialin)"
    objExcel.Cells(x, 2).Value = "Deny access"
    End If
    End If

  • #2
    Re: VB Script pull dial in tab propery

    You showed only a little part of the script, it could also have something to do how values are written to the xls file.

    Try this just to check the property,
    Code:
    ' If an attribute does not contain a value, the attribute
    ' does not exist according to LDAP specifications.
    ' This results in an ADSI error with the following error code value
    Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D
    
    Set objOU = GetObject _
       ("LDAP://OU=Employees,OU=company users,DC=domain,DC=local")  
    objOU.filter= Array("User")
    
    On Error Resume Next
    For Each obj In objOU  
       If (obj.Class = "user") Then
    
          strUser = obj.cn
          blnMsNPAllowDialin = obj.Get("msNPAllowDialin")
    
          If Err.Number = E_ADS_PROPERTY_NOT_FOUND Then
             strLine = strLine & strUser & " - not set" & vbNewLine
             Err.Clear
          Else
             If blnMsNPAllowDialin = True Then
                strLine = strLine & strUser & " - Allow access" _
                         & vbNewLine
             Else
                strLine = strLine & strUser & " - Deny access" _ 
                         & vbNewLine
             End If
          End If
    
       End If
    Next
    On Error Goto 0
    
    strTitle = "Remote Access Permission (Dial-in or VPN)" _
                         & vbNewLine & vbNewLine
    wscript.echo strTitle & strLine
    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment

    Working...
    X