Page 1 of 1

PS Script to PrimalForms 2011

Posted: Fri Aug 03, 2012 5:44 am
by PBilat
Hello everybody I use this PS Script to search Group Policy Settings. Can somebody help me to create a PrimalForms with all the PS Script content PS Script and details:

<#

.Synopsis


Searches text files by pattern and displays the results.

.Description


Searches text files by pattern and displays the results.

.Notes

Based
on versions from http://weblogs.asp.net/whaggard/archive ... utput.aspx
and from http://poshcode.org/426



Makes
use of Out-ColorMatchInfo found at http://poshcode.org/1095.

#>



#requires
-version 2

param
(


[Parameter(Mandatory=$true)]


[regex] $pattern,


# [string] $folderpath = (Read-Host "Please enter folder to
check","Ex. C:TestsGPOReports"),


[string] $folderpath = "C:TestsGPOReports",


# [string] $filter = (Read-Host "Please insert the
File-Extension","Ex. *.HTML"),


[string] $filter = "*.HTML",


[switch] $recurse = $true,


[switch] $caseSensitive = $false,


[int[]] $context = 0

)



if
((-not $caseSensitive) -and (-not $pattern.Options -match
"IgnoreCase")) {


$pattern = New-Object regex
$pattern.ToString(),@($pattern.Options,"IgnoreCase")

}



#
Output as "Out-GridView"

Get-ChildItem
-Path:$folderpath -recurse:$recurse -filter:$filter | Select-String
-caseSensitive:$caseSensitive -pattern:$pattern -AllMatches -context $context |
Out-Gridview



#
Output as "CSV-File"

#
Get-ChildItem -Path:$folderpath -recurse:$recurse -filter:$filter |
Select-String -caseSensitive:$caseSensitive -pattern:$pattern -AllMatches
-context $context | Export-CSV -path C:TestsGPOSearch-Result.csv
-notypeinformation -Delimiter ';' -Encoding 'ASCII'



#
Output as "Format-Talbe"

#
Get-ChildItem -Path:$folderpath -recurse:$recurse -filter:$filter |
Select-String -caseSensitive:$caseSensitive -pattern:$pattern -AllMatches
-context $context | Format-Table LineNumber, Line, Filename, Path -Wrap |
Out-File C:TestsGPOResult.txt

#
Invoke-Item C:TestsGPOResult.txt







General
information:

When the
Administrator start the PS script, a popup windows appears in which the Admin
must insert the desire

PS Script to PrimalForms 2011

Posted: Fri Aug 03, 2012 5:46 am
by Alexander Riedel
Our sister site www.scriptinganswers.com would be the place for these types of questions.
davidc2012-08-03 13:56:10