0

I am working on using Server 2008R2 Forest to house AutoFS maps in the existing schema using NISMap and NisObject class objects. I can manually create them (and it works) with ADSIedit. I have previously scripted creating users(in AutoIT), but this is not a user object and has different default attributes. I know how to edit arbitrary attributes, but not how to create an arbitrary object class.

All the Documentation I've found googling around shows functions to create users via LDAP or AD libraries, but nothing that lets me specify a (admittedly obscure) object class like I can in the ADSI gui.

I am open to any scripting language, but most likely will either be using AutoIT on Windows (which could use powershell) or Bash or Python on RHEL.

1
  • I suggest using the ADSI connector in powershell to programmatically manage such objects.
    – Andy
    Jan 23, 2015 at 11:00

1 Answer 1

1

Per Andy (who didn't provide an answer I can mark correct), I ended up using Powershell to do this:

powershell
Import-Module ActiveDirectory
New-ADObject -Name auto.folder2 -Path 'CN=autofs,DC=example' -Type nisMap -OtherAttributes @{'nisMapName'='auto.folder2'}
New-ADObject -Name /testldap/folder2 -Path 'CN=auto.master,CN=autofs,DC=example' -Type nisObject -OtherAttributes @{'nisMapName'='auto.master' ; 'nisMapEntry'='auto.folder2'}

This creates the Map and then the Mount entry in auto.master (assumed created previously, can be done like the first command.

New-ADObject -Name test2 -Path 'CN=auto.testldap,CN=autofs,DC=example' -Type nisObject -OtherAttributes @{'nisMapName'='auto.testldap'; 'nisMapEntry'='lnx:/mnt/test'}

This then creates an actual mount mapping inside an existing map entry.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .