Update : version 0.94 now available
Hot on the heals of my AD sites module, I have been looking at some file system functions. This module is driven primarily by my own needs, but after a prompt on the powergui website from someone after a way of managing DFS with powershell (thanks packetboy), this is what I have come up with. All help files are included with examples, but I will publish the help and examples over time.
Requirements
This module has been built on a Windows 2008 R2 platform and therefore the DFS functions will be based around the 2008 R2 version of DFSUTIL. This is not to say that it is not compatible with anything earlier, it has just not been tested.
Installation and use
Download the zip file and extract to your modules folder. This can be found by running "explorer $pshome\modules" from a PowerShell console. To use, run "import-module Filesystem"
Command list and Help
To retrieve the list of commands and get help, as with all PowerShell functions and cmdlets use the built in get-command and get-help.
Get-command -module filesystem will list all the commands from the module
Get-help get-dfsroot -full will display the full help file
Included functions
add-DFSlinkABEPermission
add-DFSLinkTarget
add-DFSRootTarget
Add-NTFSPermission
disable-DFSLinkTarget
disable-DFSrootABE
enable-DFSLinkTarget
enable-DFSrootABE
get-DFSLink
get-DFSlinkABEPermission
get-dfsroot
get-DFSRootABEStatus
get-shareConnection
new-DFSLink
new-DFSroot
new-FileShare
remove-DFSLink
remove-DFSlinkABEPermission
remove-DFSLinkTarget
remove-DFSRoottarget
Remove-NTFSPermission
set-ntfsInheritance
set-sharepermission
test-fileshare
Please let me know any feedback in the comments, and of course, test in a development environment before using in production.
The module can be downloaded here.
cheers
Adam
Tuesday, September 20, 2011
Subscribe to:
Post Comments (Atom)
Thanks. Just what I was looking for. Works nicely.
ReplyDeleteThis is really really useful thank you. One comment though - it appears from my early testing that since you're picking up the $env:USERDOMAIN value and referencing it as $netbiosdomain, then using that as a reference on the "object" parameters for adding / removing NTFS permissions, you can't specify for example, the builtin\users group to act upon?
ReplyDeletehaving said that, commenting out the $userdomain argument and its comma within the argumentlist parameter of the ntaccount class does the trick, just means you need to specify the domain as part of the -object parameter
ReplyDeletethanks for the feedback. I will update the functions to allow for built in groups to be added.
ReplyDeletecheers
Me again - Following your lead, I've created equivalent DFSR functions to create replication groups, add members, add connections, add folders etc. Not quite as elegant as your DFSN / file services module but if you want the code to add to your module or to update and publish as you see fit, you're welcome to it, after all the work you saved me by making your module available.
ReplyDeleteThank you, works very well, the only way I found to get a decent formatting when listing DFS targets. You might consider changing the module-name from filesystem to something more unique, I already had another module named filesystem, I suspect it is common.
ReplyDelete