PowerShell Example Code
On this page I’ll link to sample code that can be downloaded and used as an example of how certain actions can be done. These are based on the examples that have been used in posts, and whereas they are probably more complete than the code in the posts, they are still for educational purposes only!
There is no error checking, return codes or anything fancy to ensure that everything is being executed as expected. Despite this I hope you find them useful!
Filesystem:
Setting Access Control Lists (ACLs) : SetACL.ps1
Active Directory:
Converting a DN to an FQDN : Convert-DNtoFQDN.ps1
Raising Domain/Forest Functionality : RaiseFunc.ps1
Enable/Disable the Global Catalog role : SetGCrole.ps1
Retrieving FSMO roles : GetFSMO.ps1
Creating a Group : New-Group.ps1
Creating a Account : New-Account.ps1
Search for DC’s in AD that are not 2003 Servers : FindPre2K3.ps1

This work is licensed under a Creative Commons Attribution 3.0 License.