mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-07-26 11:49:17 +00:00
Update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
|
||||
|
||||
$Output = Find-GPO #-NoTranslation
|
||||
$Output = Invoke-GPOZaurr #-NoTranslation
|
||||
|
||||
New-HTML {
|
||||
foreach ($GPOCategory in $Output.Keys) {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
|
||||
|
||||
# Use Save-GPOZaurrFiles -GPOPath $ENV:USERPROFILE\Desktop\GPOExport
|
||||
|
||||
$OutputTranslation = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExport'
|
||||
$OutputTranslation | Format-Table
|
||||
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExport' -NoTranslation
|
||||
$Output | Format-Table *
|
||||
|
||||
#$Output.LugsSettings.LocalUsersAndGroups | Format-List *
|
||||
|
||||
$GPOEntry = $Output.LugsSettings.LocalUsersAndGroups[0]
|
||||
|
||||
$CreateGPO = @{}
|
||||
foreach ($User in $GPOEntry.User) {
|
||||
# $User | Format-Table
|
||||
# $User.Properties | Format-Table
|
||||
}
|
||||
|
||||
|
||||
foreach ($Group in $GPOEntry.Group) {
|
||||
#$Group | Format-Table
|
||||
$Group.Properties | Format-Table
|
||||
$Group.Properties.Members | Format-Table
|
||||
}
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
# Use Save-GPOZaurrFiles -GPOPath $ENV:USERPROFILE\Desktop\GPOExport
|
||||
|
||||
$Output = Find-GPO -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' -NoTranslation
|
||||
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' -NoTranslation
|
||||
$Output | Format-Table *
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# This is purely for building GPO Dictionary, mostly for development needs to help asses what is there
|
||||
|
||||
$Output = Find-GPO -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' -NoTranslation
|
||||
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' -NoTranslation
|
||||
#$Output | Format-Table *
|
||||
|
||||
$LookingFor = $Output | Select-GPOTranslation -Category 'SecuritySettings' -Settings 'UserRightsAssignment'
|
||||
|
||||
@@ -2,16 +2,20 @@
|
||||
|
||||
# Use Save-GPOZaurrFiles -GPOPath $ENV:USERPROFILE\Desktop\GPOExport
|
||||
|
||||
$Output = Find-GPO -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' #-NoTranslation
|
||||
$Output = Invoke-GPOZaurr -GPOPath 'C:\Support\GitHub\GpoZaurr\Ignore\GPOExportTest' #-NoTranslation
|
||||
$Output | Format-Table *
|
||||
|
||||
New-HTML {
|
||||
foreach ($GPOCategory in $Output.Keys) {
|
||||
New-HTMLTab -Name $GPOCategory {
|
||||
foreach ($GpoSettings in $Output.$GPOCategory.Keys) {
|
||||
New-HTMLTab -Name $GpoSettings {
|
||||
New-HTMLTable -DataTable $Output[$GPOCategory][$GpoSettings] -ScrollX -DisablePaging -AllProperties -Title $Key
|
||||
if ($Output["$GPOCategory"] -is [System.Collections.IDictionary]) {
|
||||
foreach ($GpoSettings in $Output["$GPOCategory"].Keys) {
|
||||
New-HTMLTab -Name $GpoSettings {
|
||||
New-HTMLTable -DataTable $Output[$GPOCategory][$GpoSettings] -ScrollX -DisablePaging -AllProperties -Title $Key
|
||||
}
|
||||
}
|
||||
} else {
|
||||
New-HTMLTable -DataTable $Output[$GPOCategory] -ScrollX -DisablePaging -AllProperties -Title $Key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
@{
|
||||
AliasesToExport = ''
|
||||
AliasesToExport = 'Find-GPO'
|
||||
Author = 'Przemyslaw Klys'
|
||||
CompanyName = 'Evotec'
|
||||
CompatiblePSEditions = 'Desktop'
|
||||
Copyright = '(c) 2011 - 2020 Przemyslaw Klys @ Evotec. All rights reserved.'
|
||||
Description = 'Group Policy Eater is a PowerShell module that aims to gather information about Group Policies but also allows easy fixing for issues that you may expect finding in them.'
|
||||
FunctionsToExport = 'Add-GPOPermission', 'Add-GPOZaurrPermission', 'Backup-GPOZaurr', 'Find-GPO', 'Get-GPOZaurr', 'Get-GPOZaurrAD', 'Get-GPOZaurrBackupInformation', 'Get-GPOZaurrFiles', 'Get-GPOZaurrLegacyFiles', 'Get-GPOZaurrLink', 'Get-GPOZaurrLinkSummary', 'Get-GPOZaurrOwner', 'Get-GPOZaurrPassword', 'Get-GPOZaurrPermission', 'Get-GPOZaurrPermissionConsistency', 'Get-GPOZaurrSysvol', 'Get-WMIFilter', 'Get-GPOZaurrWMI', 'Invoke-GPOZaurrPermission', 'New-GPOZaurrWMI', 'Remove-GPOPermission', 'Remove-GPOZaurr', 'Remove-GPOZaurrLegacyFiles', 'Remove-GPOZaurrOrphanedSysvolFolders', 'Remove-GPOZaurrPermission', 'Remove-GPOZaurrWMI', 'Repair-GPOZaurrPermissionConsistency', 'Restore-GPOZaurr', 'Save-GPOZaurrFiles', 'Select-GPOTranslation', 'Set-GPOOwner', 'Set-GPOZaurrOwner'
|
||||
FunctionsToExport = 'Add-GPOPermission', 'Add-GPOZaurrPermission', 'Backup-GPOZaurr', 'Get-GPOZaurr', 'Get-GPOZaurrAD', 'Get-GPOZaurrBackupInformation', 'Get-GPOZaurrFiles', 'Get-GPOZaurrLegacyFiles', 'Get-GPOZaurrLink', 'Get-GPOZaurrLinkSummary', 'Get-GPOZaurrOwner', 'Get-GPOZaurrPassword', 'Get-GPOZaurrPermission', 'Get-GPOZaurrPermissionConsistency', 'Get-GPOZaurrSysvol', 'Get-WMIFilter', 'Get-GPOZaurrWMI', 'Invoke-GPOZaurr', 'Invoke-GPOZaurrPermission', 'New-GPOZaurrWMI', 'Remove-GPOPermission', 'Remove-GPOZaurr', 'Remove-GPOZaurrLegacyFiles', 'Remove-GPOZaurrOrphanedSysvolFolders', 'Remove-GPOZaurrPermission', 'Remove-GPOZaurrWMI', 'Repair-GPOZaurrPermissionConsistency', 'Restore-GPOZaurr', 'Save-GPOZaurrFiles', 'Select-GPOTranslation', 'Set-GPOOwner', 'Set-GPOZaurrOwner'
|
||||
GUID = 'f7d4c9e4-0298-4f51-ad77-e8e3febebbde'
|
||||
ModuleVersion = '0.0.46'
|
||||
PowerShellVersion = '5.1'
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
$SecurityOptions = @{
|
||||
Category = 'SecuritySettings'
|
||||
Settings = 'SecurityOptions'
|
||||
# This is to make sure we're not loosing anything
|
||||
# We will detect this and if something is missing provide details
|
||||
PossibleProperties = @(
|
||||
'KeyName'
|
||||
'SettingNumber'
|
||||
'Display'
|
||||
'SystemAccessPolicyName'
|
||||
'SettingString'
|
||||
)
|
||||
Translate = [ordered] @{
|
||||
'KeyName' = 'KeyName'
|
||||
'KeyDisplayName' = 'Display', 'Name'
|
||||
'KeyDisplayUnits' = 'Display', 'Units'
|
||||
'KeyDisplayBoolean' = 'Display', 'DisplayBoolean'
|
||||
'KeyDisplayString' = 'Display', 'DisplayString'
|
||||
'SystemAccessPolicyName' = 'SystemAccessPolicyName'
|
||||
'SettingString' = 'SettingString'
|
||||
'SettingNumber' = 'SettingNumber'
|
||||
}
|
||||
Types = [ordered] @{
|
||||
'KeyDisplayBoolean' = { try { [bool]::Parse($args) } catch { $null } }
|
||||
}
|
||||
}
|
||||
|
||||
$LugsSettingsLocalUsersAndGroups = @{
|
||||
PossibleProperties = @(
|
||||
'clsid'
|
||||
'Group'
|
||||
'User'
|
||||
)
|
||||
CustomCode = {
|
||||
|
||||
}
|
||||
<#
|
||||
LoopOver = @{
|
||||
User = @{
|
||||
|
||||
}
|
||||
Group = @{
|
||||
|
||||
}
|
||||
}
|
||||
#>
|
||||
|
||||
|
||||
<#
|
||||
Translate = [ordered] @{
|
||||
Name = #= $Entry.name
|
||||
Changed = #= [DateTime] $Entry.changed
|
||||
GPOSettingOrder = #= $Entry.GPOSettingOrder
|
||||
Filters = #= $Entry.Filters
|
||||
ActionType = #= $NestedType
|
||||
Action = #= $Entry.Properties.Action
|
||||
UserName = #= $Entry.Properties.userName
|
||||
NewName = #= $Entry.Properties.newName
|
||||
Description = #= $Entry.Properties.description
|
||||
DeleteAllUsers = #= [bool] $Entry.Properties.deleteAllUsers
|
||||
DeleteAllGroups = #= [bool] $Entry.Properties.deleteAllGroups
|
||||
RemoveAccounts = #= [bool] $Entry.Properties.removeAccounts
|
||||
GroupSid = #= $Entry.Properties.groupSid
|
||||
GroupName = #= $Entry.Properties.groupName
|
||||
MembersName = #= $Member.Name
|
||||
MembersAction = #= $Member.Action
|
||||
MembersSid = #= $Member.Sid
|
||||
FullName = #= $Entry.Properties.fullName
|
||||
AccountCpassword = #= $Entry.Properties.cpassword
|
||||
AccountChangeLogon = #= [bool] $Entry.Properties.changeLogon
|
||||
AccountNoChange = #= [bool] $Entry.Properties.noChange
|
||||
AccountNeverExpires= #= [bool] $Entry.Properties.neverExpires
|
||||
AccountDisabled = #= [bool] $Entry.Properties.acctDisabled
|
||||
SubAuthority = #= $Entry.Properties.subAuthority
|
||||
}
|
||||
#>
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
$SecuritySettingsSecurityOptions = @{
|
||||
# This is to make sure we're not loosing anything
|
||||
# We will detect this and if something is missing provide details
|
||||
PossibleProperties = @(
|
||||
'KeyName'
|
||||
'SettingNumber'
|
||||
'Display'
|
||||
'SystemAccessPolicyName'
|
||||
'SettingString'
|
||||
)
|
||||
Translate = [ordered] @{
|
||||
'KeyName' = 'KeyName'
|
||||
'KeyDisplayName' = 'Display', 'Name'
|
||||
'KeyDisplayUnits' = 'Display', 'Units'
|
||||
'KeyDisplayBoolean' = 'Display', 'DisplayBoolean'
|
||||
'KeyDisplayString' = 'Display', 'DisplayString'
|
||||
'SystemAccessPolicyName' = 'SystemAccessPolicyName'
|
||||
'SettingString' = 'SettingString'
|
||||
'SettingNumber' = 'SettingNumber'
|
||||
}
|
||||
Types = [ordered] @{
|
||||
'KeyDisplayBoolean' = { try { [bool]::Parse($args) } catch { $null } }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
[cmdletBinding()]
|
||||
param(
|
||||
[System.Collections.IDictionary] $InputData,
|
||||
[string] $Report,
|
||||
[string] $Category,
|
||||
[string] $Settings
|
||||
)
|
||||
@@ -15,7 +16,7 @@
|
||||
$AllProperties = Select-Properties -AllProperties -Objects $InputData.$Category.$Settings
|
||||
$MissingProperties = $AllProperties | Where-Object { $_ -notin 'DisplayName', 'DomainName', 'GUID', 'Linked', 'LinksCount', 'Links', 'GPOType', 'GPOCategory', 'GPOSettings' }
|
||||
foreach ($Property in $MissingProperties) {
|
||||
if ($Property -notin $Script:GPODitionary[$Category][$Settings]['PossibleProperties']) {
|
||||
if ($Property -notin $Script:GPODitionary[$Report]['PossibleProperties']) {
|
||||
Write-Warning "Invoke-Translation - We're missing property for $Category / $Settings - $Property"
|
||||
}
|
||||
}
|
||||
@@ -33,9 +34,9 @@
|
||||
}
|
||||
|
||||
# Lets loop thru each Translate Property
|
||||
foreach ($PropertyName in $Script:GPODitionary[$Category][$Settings]['Translate'].Keys) {
|
||||
foreach ($PropertyName in $Script:GPODitionary[$Report]['Translate'].Keys) {
|
||||
# We get property that we expect on our $GPOEntry object
|
||||
$Property = $Script:GPODitionary[$Category][$Settings]['Translate'][$PropertyName]
|
||||
$Property = $Script:GPODitionary[$Report]['Translate'][$PropertyName]
|
||||
|
||||
# Since it's possible we may be interested in something that is a nested property we need to do some looping into the object
|
||||
$Value = $GPOEntry
|
||||
@@ -44,9 +45,9 @@
|
||||
}
|
||||
# Now we simply assing that value to new GPO Entry
|
||||
# But before we do so, we need to check if it has required type
|
||||
if ($Script:GPODitionary[$Category][$Settings]['Types'][$PropertyName]) {
|
||||
if ($Script:GPODitionary[$Report]['Types'][$PropertyName]) {
|
||||
# This basically checks in dictionary if we want to convert the type from a string to lets say boolean or something else
|
||||
$CreateGPO["$PropertyName"] = Invoke-Command -Command $Script:GPODitionary[$Category][$Settings]['Types'][$PropertyName] -ArgumentList $Value
|
||||
$CreateGPO["$PropertyName"] = Invoke-Command -Command $Script:GPODitionary[$Report]['Types'][$PropertyName] -ArgumentList $Value
|
||||
} else {
|
||||
$CreateGPO["$PropertyName"] = $Value
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
$Script:GPODitionary = @{
|
||||
SecuritySettings = @{
|
||||
SecurityOptions = $SecuritySettingsSecurityOptions
|
||||
}
|
||||
SecurityOptions = $SecurityOptions
|
||||
#LugsSettings = @{
|
||||
# LocalUsersAndGroups = $LugsSettingsLocalUsersAndGroups
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
function Find-GPO {
|
||||
function Invoke-GPOZaurr {
|
||||
[alias('Find-GPO')]
|
||||
[cmdletBinding(DefaultParameterSetName = 'Default')]
|
||||
param(
|
||||
[Parameter(ParameterSetName = 'Default')][alias('ForestName')][string] $Forest,
|
||||
@@ -10,18 +11,7 @@
|
||||
|
||||
[Parameter(ParameterSetName = 'Default')]
|
||||
[Parameter(ParameterSetName = 'Local')]
|
||||
[ValidateSet('LocalUsersAndGroups', 'Autologon', 'RegistrySettings', 'RegistryPolicies', 'Scripts')][string[]] $Type = @(
|
||||
'LocalUsersAndGroups'
|
||||
'Autologon'
|
||||
'RegistrySettings'
|
||||
'RegistryPolicies'
|
||||
'Scripts'
|
||||
'SoftwareInstallation'
|
||||
'SecurityOptions'
|
||||
'Account'
|
||||
'SystemServices'
|
||||
),
|
||||
|
||||
[string[]] $Type,
|
||||
[Parameter(ParameterSetName = 'Default')]
|
||||
[Parameter(ParameterSetName = 'Local')]
|
||||
[switch] $NoTranslation,
|
||||
@@ -29,8 +19,13 @@
|
||||
[Parameter(ParameterSetName = 'Default')]
|
||||
[Parameter(ParameterSetName = 'Local')]
|
||||
[string] $Splitter = [System.Environment]::NewLine,
|
||||
[switch] $FullObjects
|
||||
[switch] $FullObjects,
|
||||
|
||||
[ValidateSet('HTML', 'Object')][string] $OutputType = 'Object'
|
||||
)
|
||||
if ($Type.Count -eq 0) {
|
||||
$Type = $Script:GPODitionary.Keys
|
||||
}
|
||||
if ($GPOPath) {
|
||||
if (Test-Path -LiteralPath $GPOPath) {
|
||||
<#
|
||||
@@ -159,19 +154,27 @@
|
||||
$Output
|
||||
} else {
|
||||
$TranslatedOutput = [ordered] @{}
|
||||
foreach ($Category in $Script:GPODitionary.Keys) {
|
||||
if (-not $TranslatedOutput[$Category]) {
|
||||
$TranslatedOutput[$Category] = [ordered] @{}
|
||||
}
|
||||
foreach ($Setting in $Script:GPODitionary[$Category].Keys) {
|
||||
if (-not $TranslatedOutput[$Category][$Setting]) {
|
||||
$TranslatedOutput[$Category][$Setting] = [ordered] @{}
|
||||
}
|
||||
$TranslatedOutput[$Category][$Setting] = Invoke-GPOTranslation -InputData $Output -Category $Category -Settings $Setting
|
||||
}
|
||||
foreach ($Report in $Type) {
|
||||
$Category = $Script:GPODitionary[$Report]['Category']
|
||||
$Settings = $Script:GPODitionary[$Report]['Settings']
|
||||
|
||||
#if (-not $TranslatedOutput[$Report]) {
|
||||
# $TranslatedOutput[$Report] = [ordered] @{}
|
||||
#}
|
||||
#foreach ($Setting in $Settings) {
|
||||
# if (-not $TranslatedOutput[$Category][$Settings]) {
|
||||
# $TranslatedOutput[$Category][$Settings] = [ordered] @{}
|
||||
# }
|
||||
$TranslatedOutput[$Report] = Invoke-GPOTranslation -InputData $Output -Category $Category -Settings $Settings -Report $Report
|
||||
#}
|
||||
}
|
||||
$TranslatedOutput
|
||||
}
|
||||
}
|
||||
|
||||
#Select-Properties -AllProperties -Objects ($Output.SecuritySettings.SecurityOptions | Where-Object { $_.Display -ne $null })
|
||||
[scriptblock] $SourcesAutoCompleter = {
|
||||
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters)
|
||||
|
||||
$Script:GPODitionary.Keys | Sort-Object | Where-Object { $_ -like "*$wordToComplete*" }
|
||||
}
|
||||
Register-ArgumentCompleter -CommandName Find-GPO -ParameterName Type -ScriptBlock $SourcesAutoCompleter
|
||||
@@ -42,7 +42,7 @@ That's it. Whenever there's a new version, you run the command, and you can enjo
|
||||
- 0.0.46 - Unreleased
|
||||
- Additional protection for `Get-GPOZaurrAD` for CNF duplicates
|
||||
- Update to `Save-GPOZaurrFiles`
|
||||
- Added `Find-GPO` (heavy work in progress)
|
||||
- Added `Invoke-GPOZaurr` (alias: `Find-GPO`) (heavy work in progress)
|
||||
- 0.0.45 - 26.06.2020
|
||||
- During publishing ADEssentials required functions are now merged to prevent cyclic dependency bug [Using ModuleSpec syntax in RequiredModules causes incorrect "cyclic dependency" failures](https://github.com/PowerShell/PowerShell/issues/2607)
|
||||
- 0.0.44 - 24.06.2020
|
||||
|
||||
Reference in New Issue
Block a user