Uploading just to have backup

This commit is contained in:
Przemyslaw Klys
2020-08-02 00:41:21 +02:00
parent 33b2854d63
commit d8c63ce949
9 changed files with 455 additions and 0 deletions
@@ -0,0 +1,32 @@
function Get-XMLAccount {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter = [System.Environment]::NewLine,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($Type in @('User', 'Computer')) {
if ($GPOOutput.$Type.ExtensionData.Extension) {
foreach ($ExtensionType in $GPOOutput.$Type.ExtensionData.Extension) {
foreach ($Key in $ExtensionType.Account) {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
Name = $Key.Name
Type = $Key.Type
SettingNumber = $Key.SettingNumber
SettingBoolean = if ($Key.SettingBoolean -eq 'true') { $true } elseif ($Key.SettingBoolean -eq 'false') { $false } else { $null }
}
}
}
}
}
}
@@ -0,0 +1,63 @@
function Get-XMLAutologon {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter = [System.Environment]::NewLine,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($Type in @('User', 'Computer')) {
if ($GPOOutput.$Type.ExtensionData.Extension) {
foreach ($ExtensionType in $GPOOutput.$Type.ExtensionData.Extension) {
if ($ExtensionType.RegistrySettings.Registry.Properties.Key -ne 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon') {
continue
}
$Autologon = [ordered] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
AutoAdminLogon = $null
DefaultDomainName = $null
DefaultUserName = $null
DefaultPassword = $null
}
foreach ($Key in $ExtensionType.RegistrySettings.Registry) {
if ($Key.Properties.key -eq 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon') {
<#
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $Linked
LinksCount = $LinksCount
GpoType = $Type
Changed = [DateTime] $Key.changed
GPOSettingOrder = $Key.GPOSettingOrder
hive = $Key.Properties.hive #: HKEY_LOCAL_MACHINE
key = $Key.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
name = $Key.Properties.name #: AutoAdminLogon
type = $Key.Properties.type #: REG_SZ
value = $Key.Properties.value #
Filters = $Key.Filters
}
#>
if ($Key.Properties.Name -eq 'AutoAdminLogon') {
$Autologon['AutoAdminLogon'] = [bool] $Key.Properties.value
} elseif ($Key.Properties.Name -eq 'DefaultDomainName') {
$Autologon['DefaultDomainName'] = $Key.Properties.value
} elseif ($Key.Properties.Name -eq 'DefaultUserName') {
$Autologon['DefaultUserName'] = $Key.Properties.value
} elseif ($Key.Properties.Name -eq 'DefaultPassword') {
$Autologon['DefaultPassword'] = $Key.Properties.value
}
}
}
[PSCustomObject] $Autologon
}
}
}
}
@@ -0,0 +1,93 @@
function Get-XMLLocalUserGroups {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter = [System.Environment]::NewLine,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($Type in @('User', 'Computer')) {
if ($GPOOutput.$Type.ExtensionData.Extension.LocalUsersAndGroups) {
foreach ($NestedType in @('User', 'Group')) {
if ($GPOOutput.$Type.ExtensionData.Extension.LocalUsersAndGroups.$NestedType) {
foreach ($Entry in $GPOOutput.$Type.ExtensionData.Extension.LocalUsersAndGroups.$NestedType) {
if ($Entry.Properties.Members) {
foreach ($Members in $Entry.Properties.Members) {
foreach ($Member in $Members.Member) {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
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
}
}
}
} else {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
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 = $null
MembersAction = $null
MembersSid = $null
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
}
}
}
}
}
}
}
}
@@ -0,0 +1,41 @@
function Get-XMLRegistryPolicies {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter = [System.Environment]::NewLine,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($Type in @('User', 'Computer')) {
if ($GPOOutput.$Type.ExtensionData.Extension) {
foreach ($ExtensionType in $GPOOutput.$Type.ExtensionData.Extension) {
foreach ($Key in $ExtensionType.Policy) {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
PolicyName = $Key.Name
PolicyState = $Key.State
PolicyCategory = $Key.Category
PolicySupported = $Key.Supported
PolicyExplain = $Key.Explain
PolicyCheckBox = $Key.CheckBox
PolicyText = $Key.Text
DropDownList = $Key.DropDownList
PolicyEditText = $Key.EditText
<#
Name State Value
---- ----- -----
Target group name for this computer Enabled de00_wsus3_measuring_devices
#>
}
}
}
}
}
}
@@ -0,0 +1,35 @@
function Get-XMLRegistrySettings {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter = [System.Environment]::NewLine,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($Type in @('User', 'Computer')) {
if ($GPOOutput.$Type.ExtensionData.Extension) {
foreach ($ExtensionType in $GPOOutput.$Type.ExtensionData.Extension) {
foreach ($Key in $ExtensionType.RegistrySettings.Registry) {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
Changed = [DateTime] $Key.changed
GPOSettingOrder = $Key.GPOSettingOrder
Hive = $Key.Properties.hive #: HKEY_LOCAL_MACHINE
Key = $Key.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Name = $Key.Properties.name #: AutoAdminLogon
Type = $Key.Properties.type #: REG_SZ
Value = $Key.Properties.value #
Filters = $Key.Filters
}
}
}
}
}
}
@@ -0,0 +1,49 @@
function Get-XMLScripts {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter = [System.Environment]::NewLine,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($Type in @('User', 'Computer')) {
if ($GPOOutput.$Type.ExtensionData.Extension) {
foreach ($ExtensionType in $GPOOutput.$Type.ExtensionData.Extension) {
foreach ($Key in $ExtensionType.Script) {
if ($FullObjects) {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
Command = $Key.Command
Parameters = $Key.Parameters
Type = $Key.Type
Order = $Key.Order
RunOrder = $Key.RunOrder
}
} else {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
Command = $Key.Command
Parameters = $Key.Parameters
type = $Key.Type
Order = $Key.Order
RunOrder = $Key.RunOrder
}
}
}
}
}
}
}
@@ -0,0 +1,29 @@
function Get-XMLSecurityOptions {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter = [System.Environment]::NewLine,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($Type in @('User', 'Computer')) {
if ($GPOOutput.$Type.ExtensionData.Extension) {
foreach ($ExtensionType in $GPOOutput.$Type.ExtensionData.Extension) {
foreach ($Key in $ExtensionType.SecurityOptions) {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
SystemAccessPolicyName = $Key.SystemAccessPolicyName
SettingNumber = $Key.SettingNumber
}
}
}
}
}
}
@@ -0,0 +1,83 @@
function Get-XMLSoftwareInstallation {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter = [System.Environment]::NewLine,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($Type in @('User', 'Computer')) {
if ($GPOOutput.$Type.ExtensionData.Extension) {
foreach ($ExtensionType in $GPOOutput.$Type.ExtensionData.Extension) {
foreach ($Key in $ExtensionType.MsiApplication) {
if ($FullObjects) {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
Identifier = $Key.Identifier #: { 10495e9e-79c1-4a32-b278-a24cd495437f }
Name = $Key.Name #: Local Administrator Password Solution (2)
Path = $Key.Path #: \\area1.local\SYSVOL\area1.local\Policies\ { 5F5042A0-008F-45E3-8657-79C87BD002E3 }\LAPS.x64.msi
MajorVersion = $Key.MajorVersion #: 6
MinorVersion = $Key.MinorVersion #: 2
LanguageId = $Key.LanguageId #: 1033
Architecture = $Key.Architecture #: 9
IgnoreLanguage = if ($Key.IgnoreLanguage -eq 'true') { $true } else { $false } #: false
Allowx86Onia64 = if ($Key.Allowx86Onia64 -eq 'true') { $true } else { $false } #: true
SupportURL = $Key.SupportURL #:
AutoInstall = if ($Key.AutoInstall -eq 'true') { $true } else { $false } #: true
DisplayInARP = if ($Key.DisplayInARP -eq 'true') { $true } else { $false } #: true
IncludeCOM = if ($Key.IncludeCOM -eq 'true') { $true } else { $false } #: true
SecurityDescriptor = $Key.SecurityDescriptor #: SecurityDescriptor
DeploymentType = $Key.DeploymentType #: Assign
ProductId = $Key.ProductId #: { ea8cb806-c109 - 4700 - 96b4-f1f268e5036c }
ScriptPath = $Key.ScriptPath #: \\area1.local\SysVol\area1.local\Policies\ { 5F5042A0-008F-45E3-8657-79C87BD002E3 }\Machine\Applications\ { EAC9B821-FB4D - 457A-806F-E5B528D1E41A }.aas
DeploymentCount = $Key.DeploymentCount #: 0
InstallationUILevel = $Key.InstallationUILevel #: Maximum
Upgrades = if ($Key.Upgrades.Mandatory -eq 'true') { $true } else { $false } #: Upgrades
UninstallUnmanaged = if ($Key.UninstallUnmanaged -eq 'true') { $true } else { $false } #: false
LossOfScopeAction = $Key.LossOfScopeAction #: Unmanage
}
} else {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
Identifier = $Key.Identifier #: { 10495e9e-79c1-4a32-b278-a24cd495437f }
Name = $Key.Name #: Local Administrator Password Solution (2)
Path = $Key.Path #: \\area1.local\SYSVOL\area1.local\Policies\ { 5F5042A0-008F-45E3-8657-79C87BD002E3 }\LAPS.x64.msi
MajorVersion = $Key.MajorVersion #: 6
MinorVersion = $Key.MinorVersion #: 2
LanguageId = $Key.LanguageId #: 1033
Architecture = $Key.Architecture #: 9
IgnoreLanguage = if ($Key.IgnoreLanguage -eq 'true') { $true } else { $false } #: false
Allowx86Onia64 = if ($Key.Allowx86Onia64 -eq 'true') { $true } else { $false } #: true
SupportURL = $Key.SupportURL #:
AutoInstall = if ($Key.AutoInstall -eq 'true') { $true } else { $false } #: true
DisplayInARP = if ($Key.DisplayInARP -eq 'true') { $true } else { $false } #: true
IncludeCOM = if ($Key.IncludeCOM -eq 'true') { $true } else { $false } #: true
SecurityDescriptor = $Key.SecurityDescriptor #: SecurityDescriptor
DeploymentType = $Key.DeploymentType #: Assign
ProductId = $Key.ProductId #: { ea8cb806-c109 - 4700 - 96b4-f1f268e5036c }
ScriptPath = $Key.ScriptPath #: \\area1.local\SysVol\area1.local\Policies\ { 5F5042A0-008F-45E3-8657-79C87BD002E3 }\Machine\Applications\ { EAC9B821-FB4D - 457A-806F-E5B528D1E41A }.aas
DeploymentCount = $Key.DeploymentCount #: 0
InstallationUILevel = $Key.InstallationUILevel #: Maximum
Upgrades = if ($Key.Upgrades.Mandatory -eq 'true') { $true } else { $false } #: Upgrades
UninstallUnmanaged = if ($Key.UninstallUnmanaged -eq 'true') { $true } else { $false } #: false
LossOfScopeAction = $Key.LossOfScopeAction #: Unmanage
}
}
}
}
}
}
}
@@ -0,0 +1,30 @@
function Get-XMLSystemServices {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[System.Xml.XmlElement[]] $GPOOutput,
[string] $Splitter = [System.Environment]::NewLine,
[switch] $FullObjects
)
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
foreach ($Type in @('User', 'Computer')) {
if ($GPOOutput.$Type.ExtensionData.Extension) {
foreach ($ExtensionType in $GPOOutput.$Type.ExtensionData.Extension) {
foreach ($Key in $ExtensionType.SystemServices) {
[PSCustomObject] @{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.Guid
Linked = $LinksInformation.Linked
LinksCount = $LinksInformation.LinksCount
Links = $LinksInformation.Links
GpoType = $Type
Name = $Key.Name
StartupMode = $Key.StartupMode
}
}
}
}
}
}