Tuesday, March 6, 2012

Get-GPOData

#Function - Pulls GPO Settings and reports them via an HTML document
function Show-GPOReport {
  param(
  $GPOName = $null,
  $filename = "$env:temp\report.hta"
  )
  Import-Module GroupPolicy
  if ($GPOName -eq $null) {
    Get-GPO -All | Select-Object -ExpandProperty DisplayName
  } else {
    Get-GPOReport -Name $GPOName -ReportType Html | Out-File $filename
    Invoke-Item $filename
  }
}

#Query user for GPO "Name"
$param1 = read-host "Enter Desired GPO"
#Calls function with parameter.
Show-GPOReport $param1

No comments:

Post a Comment