Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed May 14, 2020
1 parent 35e2a54 commit 3efc3d0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
9 changes: 7 additions & 2 deletions Examples/GetDomainControllers.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Import-Module .\PSsharedGoods.psd1 -Force

$ForestInformation = Get-WinADForestDetails #-IncludeDomains 'ad.evotec.pl' -ExcludeDomainControllers adpreview2019
$ForestInformation = Get-WinADForestDetails -Extended #-IncludeDomains 'ad.evotec.pl' -ExcludeDomainControllers adpreview2019
#$ForestInformation.ForestDomainControllers | ft -AutoSize
$F2 = Copy-Dictionary $ForestInformation

$F = Get-WinADForestDetails -ExtendedForestInformation $ForestInformation -IncludeDomains 'ad.evotec.pl' -ExcludeDomainControllers adpreview2019
$F.ForestDomainControllers | Format-Table -AutoSize
$F.ForestDomainControllers | Format-Table -AutoSize

$F2 = Copy-Dictionary $F

Get-WinADForestDetails -ExtendedForestInformation $F2 #-IncludeDomains 'ad.evotec.pl' -ExcludeDomainControllers adpreview2019
4 changes: 2 additions & 2 deletions PSSharedGoods.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Przemyslaw Klys
#
# Generated on: 11.05.2020
# Generated on: 14.05.2020
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = 'PSSharedGoods.psm1'

# Version number of this module.
ModuleVersion = '0.0.140'
ModuleVersion = '0.0.141'

# Supported PSEditions
CompatiblePSEditions = 'Desktop', 'Core'
Expand Down
22 changes: 21 additions & 1 deletion Public/ActiveDirectory/Get-WinADForestDetails.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@
} else {
$ForestInformation = Get-ADForest -ErrorAction Stop
}
<#
$ForestInformation = [ordered] @{
ApplicationPartitions = $ForestInf.ApplicationPartitions | ForEach-Object -Process { $_ } # : {DC=DomainDnsZones,DC=ad,DC=evotec,DC=xyz, DC=DomainDnsZones,DC=ad,DC=evotec,DC=pl, DC=ForestDnsZones,DC=ad,DC=evotec,DC=xyz}
CrossForestReferences = $ForestInf.CrossForestReferences | ForEach-Object -Process { $_ } # : {}
DomainNamingMaster = $ForestInf.DomainNamingMaster # : AD1.ad.evotec.xyz
Domains = $ForestInf.Domains | ForEach-Object -Process { $_ } # : {ad.evotec.xyz, ad.evotec.pl}
ForestMode = $ForestInf.ForestMode # : Windows2012R2Forest
GlobalCatalogs = $ForestInf.GlobalCatalogs | ForEach-Object -Process { $_ } # : {AD1.ad.evotec.xyz, AD2.ad.evotec.xyz, ADRODC.ad.evotec.pl, AD3.ad.evotec.xyz...}
Name = $ForestInf.Name # : ad.evotec.xyz
PartitionsContainer = $ForestInf.PartitionsContainer # : CN=Partitions,CN=Configuration,DC=ad,DC=evotec,DC=xyz
RootDomain = $ForestInf.RootDomain # : ad.evotec.xyz
SchemaMaster = $ForestInf.SchemaMaster # : AD1.ad.evotec.xyz
Sites = $ForestInf.Sites | ForEach-Object -Process { $_ } # : {KATOWICE-1, KATOWICE-2}
SPNSuffixes = $ForestInf.SPNSuffixes | ForEach-Object -Process { $_ } # : {}
UPNSuffixes = $ForestInf.UPNSuffixes | ForEach-Object -Process { $_ } # : {myneva.eu, single.evotec.xyz, newUPN@com, evotec.xyz...}
}
#>
} catch {
Write-Warning "Get-WinADForestDetails - Error discovering DC for Forest - $($_.Exception.Message)"
return
Expand Down Expand Up @@ -269,7 +286,10 @@
foreach ($_ in [string[]] $Findings.DomainsExtended.Keys) {
if ($_ -notin $Findings.Domains) {
$Findings.DomainsExtended.Remove($_)
$Findings.DomainsExtendedNetBIOS.Remove($_.NetBIOSName)
$NetBiosName = $Findings.DomainsExtended.$_.'NetBIOSName'
if ($NetBiosName) {
$Findings.DomainsExtendedNetBIOS.Remove($NetBiosName)
}
}
}
[Array] $Findings['ForestDomainControllers'] = foreach ($Domain in $Findings.Domains) {
Expand Down
4 changes: 2 additions & 2 deletions Public/FilesFolders/Set-FileOwner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
Begin { }
Process {
foreach ($P in $Path) {
if ($P[0] -is [System.IO.FileSystemInfo]) {
if ($P -is [System.IO.FileSystemInfo]) {
$FullPath = $P.FullName
} elseif ($P[0] -is [string]) {
} elseif ($P -is [string]) {
$FullPath = $P
}
$OwnerTranslated = [System.Security.Principal.NTAccount]::new($Owner)
Expand Down
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ More information can be found on dedicated page for [PSSharedGoods](https://evot

## Changelog

- 0.0.141 - 2020.05.14
- Improved `Set-FileOwner`
- Improved `Get-WinADForestDetails`
- 0.0.140 - 2020.05.10
- Improved `Get-FilePermission`
- 0.0.139 - 2020.05.09
Expand Down

0 comments on commit 3efc3d0

Please sign in to comment.