Set-GPODescription.psm1

Function Set-GPODescription {

#clear all the descriptions

do {

$question1 = read-host "Do you want to delete all the GPO Descriptions ? (Y/N)"
Clear-Host

if ($question1 -eq "Y") {

get-gpo -all | ForEach-Object {$_.description = $null}

 }

} until (($question1 -eq "Y") -or ($question1 -eq "N"))

#GPO Loop

$gpos = Get-GPO -all

foreach ($gpo in $gpos) {

$gpodn = $gpo.displayname

#Checking if description exists

if ($gpo | ? {$_.description -eq "" -or $null}) {

$question2 = Read-Host "Description for the GPO $gpodn "

#Set the description

$gpo.description = $question2 

 } 
}

#Final Report

Get-GPO -all | select displayname,owner,ID,description | ogv

}