1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

A call to the scripting daddys!

Discussion in 'Scripting & Programming' started by Phoenix, Apr 25, 2005.

  1. Phoenix
    Honorary Member

    Phoenix 53656e696f7220 4d6f64

    5,726
    175
    221
    So, were trying to disable outlook mobile access to all users and found this nice script that does it, however, im a bit unsure of the Ldap query as its not like one im used to
    which part would i chance to point it to a perticular OU in my forest?

    Code:
    On Error Resume Next
    Set objRootDSE = GetObject("LDAP://rootDSE")
    Set objUsers = GetObject("LDAP://cn=Users," & objRootDSE.Get("defaultNamingContext"))
    ' set msExchOmaAdminWirelessEnable to 7 if currently null
    For Each objUser In objUsers
                strname = objUser.Get("name")
    '            WScript.Echo "name: " & strname
                strWirelessEnabled = objUser.Get("msExchOmaAdminWirelessEnable")
                If strWirelessEnabled = "" Then
                            objUser.Put "msExchOmaAdminWirelessEnable", "7"
                            objUser.setinfo
                End If
                strWirelessEnabled = objUser.Get("msExchOmaAdminWirelessEnable")
    Next
    WScript.Echo "Mobile Services disabled for all users" 
    
    im guessing these two
    Code:
     Set objRootDSE = GetObject("LDAP://rootDSE")
     Set objUsers = GetObject("LDAP://cn=Users," & objRootDSE.Get("defaultNamingContext"))
    
    would default naming context refur to the default parent domain, ie (local.pheo.org) and the concanate that to the Cn=users, part
    leading to something like
    "cn=users, dn=local, dn=pheo, dn=org"

    or something like that?
    any help appreciated folks :)
     
    Certifications: MCSE, MCITP, VCP
    WIP: > 0
  2. Phil
    Honorary Member

    Phil Gigabyte Poster

    1,680
    7
    87
    I reckon you're right Ryan, if the OU you are pointing to is one of the default AD containers such as Users or Computers then you need to use CN=

    If you are pointing to an OU tree you have created such as Users.London.local.Pheo.org then you would use OU=Users,OU=London,DN=local,DN=Pheo,DN=org
     
    Certifications: MCSE:M & S MCSA:M CCNA CNA
    WIP: 2003 Upgrade, CCNA Upgrade
  3. Phoenix
    Honorary Member

    Phoenix 53656e696f7220 4d6f64

    5,726
    175
    221
    right so i would be safe just hard codeing that as an ldap query rather than worrying about that dynamic root ldap stuff its trying to be clever and do?
     
    Certifications: MCSE, MCITP, VCP
    WIP: > 0

Share This Page

Loading...