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

Tags: IIS, powershell, Active Directory

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”, “\ServerShare”)
$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