Script for enable adrecycle bin in Windows 2008R2

Using this small script we can easily enable the active directory recycle bin feature in windows 2008r2.we have to copy the code to text editior and save it as a powershell script format(ps1).

 

 

 

Import-Module ActiveDirectory
$strforestname=(Get-AdForest).name
Enable-AdoptionalFeature ‘Recycle Bin Feature’ -Scope ForestOrconfigurationSet -Target $strforestname

 

*note-Remember to set the execution policy before running any of the powershell script(refer the below link)

http://technet.microsoft.com/en-us/library/ee176961.aspx