Powershell 1.0 script to update Active Directory FTP User isolation attributes (msIIS-FTPDir, msIIS-FTPRoot)

I recently posted an article how to setup FTP User Isolation and Active Directory together.  Here is the article.  In the post, I mentioned you'll need to engage your AD administrator to update the two attributes.  Here is a script using Powershell 1.0.  You could expand the script to take parameters (domain controller, distinguishedName and the two attributes).  The user account that runs the script needs the proper permissions in Active Directory.

$objUser = [ADSI]"LDAP://192.168.1.1/CN=UserNameHere,OU=People,DC=SteveSchofield,DC=local"
$objUser.Put("msIIS-FTPDir", "UserNameHere")
$objUser.Put("msIIS-FTPRoot", "\\Server\Share")
$objUser.setInfo()

I tested the script on a w2k8 domain controller and from my Windows XP machine (I used the Runas command)

Cheers,

Steve Schofield
Microsoft MVP - IIS

 

Published Friday, January 02, 2009 10:18 PM by steve schofield

Comments

# re: Powershell 1.0 script to update Active Directory FTP User isolation attributes (msIIS-FTPDir, msIIS-FTPRoot)

Thursday, January 22, 2009 11:21 AM by Brian

This is a great thing for one user.  I have one question though, if I need to run this for a large number of users in a domain how would I accomplish that?

# re: Powershell 1.0 script to update Active Directory FTP User isolation attributes (msIIS-FTPDir, msIIS-FTPRoot)

Thursday, January 22, 2009 9:45 PM by steve schofield

define large?  I would think you would expand on what the article does.  I can see using this for a large number of users.

# re: Powershell 1.0 script to update Active Directory FTP User isolation attributes (msIIS-FTPDir, msIIS-FTPRoot)

Thursday, January 22, 2009 9:46 PM by steve schofield

Oh sorry, I mis-understood.  Ignore my reply. :)  You'll have to add some logic to recurse AD to get the user object and loop through running this logic.