Skip to content

Commit

Permalink
PSSA SingularNouns and ShouldProcess
Browse files Browse the repository at this point in the history
  • Loading branch information
SamErde committed Dec 11, 2024
1 parent d13bd8b commit 93a2d90
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 25 deletions.
3 changes: 3 additions & 0 deletions Active Directory/AD Groups/New-ADGroupsFromCsv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
Version: 0.1.0
#>
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('SupportsShouldProcess', '')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')]
param (
# CSV file with group names and descriptions (validate path)
[Parameter(Mandatory, Position = 0)]
Expand Down Expand Up @@ -69,6 +71,7 @@
GroupCategory = $group.Category
GroupScope = $group.Scope
Description = $group.Description
Server = $Server
}
try {
New-ADGroup @GroupParams
Expand Down
1 change: 1 addition & 0 deletions Active Directory/AD Users/Get-ADInactiveUsers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# DRAFT, WORK IN PROGRESS

[CmdletBinding()]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')]
param (
# Days to consider an account inactive
[Parameter()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Get-AccountsWithPasswordNeverExpires
#>
[CmdletBinding()]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')]
param ()

Search-ADAccount -PasswordNeverExpires
Expand Down
1 change: 1 addition & 0 deletions Active Directory/AD Users/Search-KerbDelegatedAccounts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#>

[CmdletBinding()]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')]
Param
(
# start the search at this DN. Default is to search all of the domain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function Test-IsMemberOfProtectedUsers {
#>

[CmdletBinding()]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')]
[OutputType([System.Boolean])]
param (
# User parameter accepts any input that is valid for Get-ADUser
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Get-ADSitesWithoutLinks {
function Get-ADSitesWithoutLink {
<#
.SYNOPSIS
Get all Active Directory sites that are not included in any site link.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Get-AllADSIDHistoryDetails {
function Get-AllAdSidHistoryDetail {
[CmdletBinding()]
[OutputType([hashtable])]
param ()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Get-AllADSIDHistorySourceDomains {
function Get-AllAdSidHistorySourceDomain {
<#
.SYNOPSIS
Get a list of source domains from all Active Directory objects that have SID history.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
#Find Group Policies with Missing Permissions
Function Get-GPOsMissingPermissions {
Function Get-GPOsMissingPermission {
[CmdletBinding()]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')]

$GPOs = Get-GPO -all
$GPOs = Get-GPO -All

# Check for GPOs missing Authenticated Users and Domain Computers
$GPOsMissingPermissions = New-Object System.Collections.ArrayList
foreach ($item in $GPOs) {
$GPOPermAuthUsers = Get-GPPermission -Guid $GPO.Id -All | Select-Object -ExpandProperty Trustee | Where-Object {$_.Name -eq "Authenticated Users"}
$GPOPermDomainComputers = Get-GPPermission -Guid $GPO.Id -All | Select-Object -ExpandProperty Trustee | Where-Object {$_.Name -eq "Domain Computers"}
$GPOPermAuthUsers = Get-GPPermission -Guid $GPO.Id -All | Select-Object -ExpandProperty Trustee | Where-Object { $_.Name -eq 'Authenticated Users' }
$GPOPermDomainComputers = Get-GPPermission -Guid $GPO.Id -All | Select-Object -ExpandProperty Trustee | Where-Object { $_.Name -eq 'Domain Computers' }

If (!$GPOPermAuthUsers -and !$GPOPermDomainComputers) {
$GPOsMissingPermissions.Add($item)| Out-Null
If (!$GPOPermAuthUsers -and !$GPOPermDomainComputers) {
$GPOsMissingPermissions.Add($item) | Out-Null
}
}
If ($GPOsMissingPermissions.Count -ne 0) {
Write-Warning "The following Group Policy Objects do not grant any permissions to the 'Authenticated Users' or 'Domain Computers' groups:"
Write-Warning "The following Group Policy Objects do not grant any permissions to the 'Authenticated Users' or 'Domain Computers' groups:"
foreach ($item in $GPOsMissingPermissions) {
Write-Output "'$($item.DisplayName)'"
}
}
Else {
Write-Output "There are no GPOs missing permissions for Authenticated Users AND Domain Computers."
} Else {
Write-Output 'There are no GPOs missing permissions for Authenticated Users AND Domain Computers.'
}

# Check for GPOs missing Authenticated Users
$GPOsMissingAuthenticatedUsers = New-Object System.Collections.ArrayList
foreach ($item in $GPOs) {
$GPOPermissionForAuthUsers = Get-GPPermission -Guid $item.Id -All | Select-Object -ExpandProperty Trustee | Where-Object {$_.Name -eq "Authenticated Users"}
$GPOPermissionForAuthUsers = Get-GPPermission -Guid $item.Id -All | Select-Object -ExpandProperty Trustee | Where-Object { $_.Name -eq 'Authenticated Users' }
If (!$GPOPermissionForAuthUsers) {
$GPOsMissingAuthenticatedUsers.Add($item)| Out-Null
$GPOsMissingAuthenticatedUsers.Add($item) | Out-Null
}
}
If ($GPOsMissingAuthenticatedUsers.Count -ne 0) {
Write-Warning "The following Group Policy Objects do not grant any permissions to the 'Authenticated Users' security principal:"
Write-Warning "The following Group Policy Objects do not grant any permissions to the 'Authenticated Users' security principal:"
foreach ($item in $GPOsMissingAuthenticatedUsers) {
Write-Output "'$($item.DisplayName)'"
}
}
Else {
Write-Output "There are no GPOs missing permissions for Authenticated Users."
} Else {
Write-Output 'There are no GPOs missing permissions for Authenticated Users.'
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
function Get-OUDetails {
function Get-OUDetail {
<#
.SYNOPSIS
Get advanced details about an organizational unit (OU) in Active Directory.
.DESCRIPTION
THIS IS STILL A CONCEPT WORK IN PROGRESS
.NOTES
The Test-BlockInheritence, Test-IsCriticalSystemObject, and Test-IsHiddenOU functions were all created because
The Test-BlockInheritance, Test-IsCriticalSystemObject, and Test-IsHiddenOU functions were all created because
I would rather display an explicit value (eg: $false) than a null that implies $false. Likewise, I prefer to
display a $true or $false rather than 1 or a 0.
#>
Expand All @@ -26,7 +26,7 @@ function Get-OUDetails {
CanonicalName = $OU.CanonicalName
Parent = Get-ParentOU $OU
Child = Get-ChildOU $OU
BlockInheritance = Test-BlockInheritence $OU
BlockInheritance = Test-BlockInheritance $OU
CriticalLocation = Test-IsCriticalSystemObject $OU
ShowInAdvancedViewOnly = Test-IsHiddenOU $OU
}
Expand Down Expand Up @@ -71,8 +71,8 @@ function Get-ChildOU {
$ChildOU
}

function Test-BlockInheritence {
# Check if Block Inheritence is set on an organizational unit in Active Directory
function Test-BlockInheritance {
# Check if Block Inheritance is set on an organizational unit in Active Directory
[CmdletBinding()]
[OutputType([Boolean])]
param (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Get-OverlappingOUNames {
function Get-OverlappingOUName {
[CmdletBinding()]
param (

Expand Down
1 change: 1 addition & 0 deletions DDI/Measure-DnsServerResponse.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function Measure-NetworkHops {
The server name or IP address to measure network hops to.
#>
[CmdletBinding()]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')]
[OutputType([int])]
param (
[Parameter(
Expand Down

0 comments on commit 93a2d90

Please sign in to comment.