# encoding: ascii # api: powershell # title: ResultantSetOfPolicy # description: The Get-GPResultantSetOfPolicy requires the -Path parameter and saves the output to file. This command should have been named Export-GPResultantSetOfPolicy. This is a script that does what a command with the verb get should do; return the result to the pipeline. # version: 0.1 # type: module # author: David Sjstrand # license: CC0 # x-poshcode-id: 6378 # x-archived: 2016-06-16T09:35:16 # x-published: 2016-06-11T14:09:00 # # #requires -modules GroupPolicy param([String]$Computer = 'localhost', [String]$User, [Microsoft.GroupPolicy.ReportType]$ReportType = 'XML') $gprsop = new-object Microsoft.GroupPolicy.GPRsop([Microsoft.GroupPolicy.RsopMode]::Logging,'') $gprsop.LoggingComputer = $Computer if ($PSBoundParameters.ContainsKey('User')) { $gprsop.LoggingUser = $User } $gprsop.CreateQueryResults() $report = $gprsop.GenerateReport($ReportType) if ($ReportType -eq 'XML') { return [xml]$report } return $report