Skip to content

Commit 527552d

Browse files
committed
make privates private
1 parent 1d73f54 commit 527552d

File tree

12 files changed

+55
-69
lines changed

12 files changed

+55
-69
lines changed

src/ADServices/ADAccount.psm1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
Import-Module "$PSScriptRoot\Shared\SharedMetaModule.psm1" -Verbose:$false
21
Set-StrictMode -Version Latest
32
$ErrorActionPreference = [Management.Automation.ActionPreference]::Stop
4-
3+
. $PSScriptRoot\Shared\Variables.ps1
54

65
function Enable-ADAccount {
76
[CmdletBinding(SupportsShouldProcess)]
@@ -61,5 +60,3 @@ function Disable-ADAccount {
6160
}
6261
}
6362
}
64-
65-
Export-ModuleMember -Function *-ADAccount

src/ADServices/ADGroup.psm1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Import-Module "$PSScriptRoot\Shared\SharedMetaModule.psm1" -Verbose:$false
21
Set-StrictMode -Version Latest
32
$ErrorActionPreference = [Management.Automation.ActionPreference]::Stop
3+
. $PSScriptRoot\Shared\Variables.ps1
44

55

66
function Get-ADGroup {
@@ -242,9 +242,7 @@ function Test-ADGroup {
242242
}
243243

244244

245-
Export-ModuleMember -Function *-ADGroup
246-
247-
245+
#private
248246
function Update-ADGroupEntry {
249247
param (
250248
[Parameter(Mandatory, ValueFromPipeline)]
@@ -260,6 +258,7 @@ function Update-ADGroupEntry {
260258
}
261259

262260

261+
#private
263262
function Set-ADGroupEntry {
264263
param (
265264
[Parameter(Mandatory, ValueFromPipeline)]
@@ -299,4 +298,4 @@ function Set-ADGroupEntry {
299298
Set-DirectoryEntryFlag $Entry GroupType $GroupType_UNIVERSAL_GROUP -Value $true
300299
}
301300
}
302-
}
301+
}

src/ADServices/ADGroupMember.psm1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
Import-Module "$PSScriptRoot\Shared\SharedMetaModule.psm1" -Verbose:$false
21
Set-StrictMode -Version Latest
32
$ErrorActionPreference = [Management.Automation.ActionPreference]::Stop
43

src/ADServices/ADObject.psm1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,4 @@ function Test-ADObject {
273273
# output
274274
$null -ne $entry
275275
}
276-
}
277-
278-
279-
Export-ModuleMember -Function *-ADObject
276+
}

src/ADServices/ADOrganizationalUnit.psm1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
Import-Module "$PSScriptRoot\Shared\SharedMetaModule.psm1" -Verbose:$false
21
Set-StrictMode -Version Latest
32
$ErrorActionPreference = [Management.Automation.ActionPreference]::Stop
43

@@ -219,9 +218,7 @@ function Test-ADOrganizationalUnit {
219218
}
220219

221220

222-
Export-ModuleMember -Function *-ADOrganizationalUnit
223-
224-
221+
#private
225222
function Update-ADOrganizationalUnitEntry {
226223
param (
227224
[Parameter(Mandatory, ValueFromPipeline)]
@@ -233,6 +230,7 @@ function Update-ADOrganizationalUnitEntry {
233230
}
234231

235232

233+
#private
236234
function Set-ADOrganizationalUnitEntry {
237235
param (
238236
[Parameter(Mandatory, ValueFromPipeline)]

src/ADServices/ADServices.psd1

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
ModuleVersion = '0.1.0'
2+
ModuleVersion = '0.1.1'
33
GUID = 'c29c8e32-38a3-4ed4-acc3-11ad44bcab3c'
44
Author = 'Martin C Zarate (AKA Pxtl)'
55
Copyright = '2025, Martin C Zarate'
@@ -14,6 +14,8 @@ instead of requiring that the user install RSAT.
1414
PowerShellVersion = '5.1'
1515

1616
NestedModules = @(
17+
'.\Shared\ADDirectoryEntry.psm1'
18+
'.\Shared\ADHelpers.psm1'
1719
'ADObject.psm1'
1820
'ADUser.psm1'
1921
'ADAccount.psm1'
@@ -22,6 +24,15 @@ instead of requiring that the user install RSAT.
2224
'ADOrganizationalUnit.psm1'
2325
)
2426

27+
FunctionsToExport = @(
28+
'*-ADObject'
29+
'*-ADUser'
30+
'*-ADAccount'
31+
'*-ADGroup'
32+
'*-ADGroupMember'
33+
'*-ADOrganizationalUnit'
34+
)
35+
2536
PrivateData = @{
2637
PSData = @{
2738
Tags = 'ActiveDirectory', 'DirectoryServices', 'RSAT'
@@ -30,6 +41,9 @@ instead of requiring that the user install RSAT.
3041
ProjectUri = 'https://github.com/Pxtl/powershell-modules'
3142
# IconUri = ''
3243
ReleaseNotes = @'
44+
v0.1.1
45+
- hide private functions properly
46+
3347
v0.1.0
3448
- Initial Version
3549
'@

src/ADServices/ADUser.psm1

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
Import-Module "$PSScriptRoot\Shared\SharedMetaModule.psm1"
21
Set-StrictMode -Version Latest
32
$ErrorActionPreference = [Management.Automation.ActionPreference]::Stop
4-
3+
. $PSScriptRoot\Shared\Variables.ps1
54

65
function Get-ADUser {
76
<#
@@ -224,21 +223,7 @@ function Test-ADUser {
224223
}
225224
}
226225

227-
228-
function Update-ADUserEntry {
229-
param (
230-
[Parameter(Mandatory, ValueFromPipeline)]
231-
[DirectoryServices.DirectoryEntry] $Entry
232-
)
233-
process {
234-
Update-DirectoryEntryFlag $Entry userAccountControl $UserAccountControl_ACCOUNT_DISABLED -NotePropertyName Enabled -TrueValue $false -FalseValue $true
235-
}
236-
}
237-
238-
239-
Export-ModuleMember -Function *-ADUser, *-ADUserEntry
240-
241-
226+
#private
242227
function Set-ADUserEntry {
243228
[Diagnostics.CodeAnalysis.SuppressMessage("PSShouldProcess","",Scope="Function")] # -WhatIf passed through to ADObject func
244229
[CmdletBinding(SupportsShouldProcess)]
@@ -260,4 +245,4 @@ function Set-ADUserEntry {
260245
Set-DirectoryEntryPropertyTable $Entry $OtherAttributes -WhatIf:$WhatIfPreference
261246
}
262247
}
263-
}
248+
}

src/ADServices/Shared/ADDirectoryEntry.psm1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,4 @@ function Set-DirectoryEntryPropertyTable {
146146
}
147147
}
148148
}
149-
}
150-
151-
152-
Export-ModuleMember -Function *-DirectoryEntryFlag, *-DirectoryEntryPropertyTable
149+
}

src/ADServices/Shared/ADHelpers.psm1

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
# private helpers for the other NestedModules
22
Set-StrictMode -Version Latest
33
$ErrorActionPreference = [Management.Automation.ActionPreference]::Stop
4-
5-
6-
Set-Variable UserAccountControl_ACCOUNT_DISABLED -Option ReadOnly -Value 0x02
7-
8-
# https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/11972272-09ec-4a42-bf5e-3e99b321cf55
9-
# The names do not match the GroupScope values, but that's what's documented.
10-
# "Global" group
11-
Set-Variable GroupType_ACCOUNT_GROUP -Option ReadOnly -Value 0x02
12-
# "DomainLocal" group
13-
Set-Variable GroupType_RESOURCE_GROUP -Option ReadOnly -Value 0x04
14-
# "Universal" group
15-
Set-Variable GroupType_UNIVERSAL_GROUP -Option ReadOnly -Value 0x08
16-
# Security Enabled group
17-
Set-Variable GroupType_SECURITY_ENABLED -Option ReadOnly -Value 0x80000000
18-
4+
. $PSScriptRoot\Variables.ps1
195

206
function Get-LdapSearcher {
217
[OutputType([DirectoryServices.DirectorySearcher])]
@@ -134,4 +120,12 @@ function Convert-ADIdentityToFilter {
134120
}
135121

136122

137-
Export-ModuleMember -Variable UserAccountControl_*, GroupType_* -Function *
123+
function Update-ADUserEntry {
124+
param (
125+
[Parameter(Mandatory, ValueFromPipeline)]
126+
[DirectoryServices.DirectoryEntry] $Entry
127+
)
128+
process {
129+
Update-DirectoryEntryFlag $Entry userAccountControl $UserAccountControl_ACCOUNT_DISABLED -NotePropertyName Enabled -TrueValue $false -FalseValue $true
130+
}
131+
}

src/ADServices/Shared/SharedMetaModule.psm1

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)