Skip to content

Commit 07d9114

Browse files
authored
Merge pull request #110 from JM2K69/master
Add Some Verbose Message
2 parents a64ce05 + 2b998e4 commit 07d9114

File tree

8 files changed

+29
-2
lines changed

8 files changed

+29
-2
lines changed

src/public/Compare-ADSITeamGroups.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,12 @@ Function Compare-ADSITeamGroups
8888
$ContextSplatting = @{ }
8989
if ($PSBoundParameters['Credential'])
9090
{
91+
Write-Verbose "[$FunctionName] Found Credential Parameter"
9192
$ContextSplatting.Credential = $Credential
9293
}
9394
if ($PSBoundParameters['DomainName'])
9495
{
96+
Write-Verbose "[$FunctionName] Found DomainName Parameter"
9597
$ContextSplatting.DomainName = $DomainName
9698
}
9799
}
@@ -101,6 +103,7 @@ Function Compare-ADSITeamGroups
101103

102104
if ($PSBoundParameters['BaseGroupIdentity'])
103105
{
106+
Write-Verbose "[$FunctionName] Found BaseGroupIdentity Parameter"
104107
$TeamUsersIdentity = @((Get-ADSIGroupMember -Identity ('{0}' -f $BaseGroupIdentity) -Recurse).SamAccountName)
105108
}
106109

@@ -111,6 +114,7 @@ Function Compare-ADSITeamGroups
111114
foreach ($User in $TeamUsersIdentity)
112115
{
113116
# Get all groups of a user
117+
Write-Verbose "[$FunctionName] Trying to find All Groups of a user"
114118
$Usergroups = $null
115119
$UserInfos = Get-ADSIUser -Identity $user @ContextSplatting
116120

src/public/Disable-ADSIComputer.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ function Disable-ADSIComputer
7171
$ContextSplatting = @{ }
7272
if ($PSBoundParameters['Credential'])
7373
{
74+
Write-Verbose "[$FunctionName] Found Credential Parameter"
7475
$ContextSplatting.Credential = $Credential
7576
}
7677
if ($PSBoundParameters['DomainName'])
7778
{
79+
Write-Verbose "[$FunctionName] Found DomainName Parameter"
7880
$ContextSplatting.DomainName = $DomainName
7981
}
8082

@@ -88,6 +90,8 @@ function Disable-ADSIComputer
8890
$Account = Get-ADSIComputer -Identity $Identity @ContextSplatting
8991
$Account.enabled = $false
9092
$Account.Save()
93+
Write-Verbose "[$FunctionName] The Computer $Identity was disabled"
94+
9195
}
9296
}
9397
catch

src/public/Disable-ADSIUser.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ function Disable-ADSIUser
7474
$ContextSplatting = @{ }
7575
if ($PSBoundParameters['Credential'])
7676
{
77+
Write-Verbose "[$FunctionName] Found Credential Parameter"
7778
$ContextSplatting.Credential = $Credential
7879
}
7980
if ($PSBoundParameters['DomainName'])
8081
{
82+
Write-Verbose "[$FunctionName] Found DomainName Parameter"
8183
$ContextSplatting.DomainName = $DomainName
8284
}
8385

@@ -91,6 +93,8 @@ function Disable-ADSIUser
9193
$Account = Get-ADSIUser -Identity $Identity @ContextSplatting
9294
$Account.Enabled = $false
9395
$Account.Save()
96+
Write-Verbose "[$FunctionName] The User $Identity was disabled"
97+
9498
}
9599
}
96100
catch

src/public/Enable-ADSIComputer.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ function Enable-ADSIComputer
7171
$ContextSplatting = @{ }
7272
if ($PSBoundParameters['Credential'])
7373
{
74+
Write-Verbose "[$FunctionName] Found Credential Parameter"
7475
$ContextSplatting.Credential = $Credential
7576
}
7677
if ($PSBoundParameters['DomainName'])
7778
{
79+
Write-Verbose "[$FunctionName] Found DomainName Parameter"
7880
$ContextSplatting.DomainName = $DomainName
7981
}
8082

@@ -88,6 +90,8 @@ function Enable-ADSIComputer
8890
$Account = Get-ADSIComputer -Identity $Identity @ContextSplatting
8991
$Account.enabled = $true
9092
$Account.Save()
93+
Write-Verbose "[$FunctionName] The Computer $Identity was enabled"
94+
9195
}
9296
}
9397
catch

src/public/Enable-ADSIUser.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ function Enable-ADSIUser
7575
$ContextSplatting = @{ }
7676
if ($PSBoundParameters['Credential'])
7777
{
78+
Write-Verbose "[$FunctionName] Found Credential Parameter"
7879
$ContextSplatting.Credential = $Credential
7980
}
8081
if ($PSBoundParameters['DomainName'])
8182
{
83+
Write-Verbose "[$FunctionName] Found DomainName Parameter"
8284
$ContextSplatting.DomainName = $DomainName
8385
}
8486

@@ -92,6 +94,8 @@ function Enable-ADSIUser
9294
$Account = Get-ADSIUser -Identity $Identity @ContextSplatting
9395
$Account.Enabled = $true
9496
$Account.Save()
97+
Write-Verbose "[$FunctionName] The user $Identity was enabled"
98+
9599
}
96100
}
97101
catch

src/public/Get-ADSIComputer.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ function Get-ADSIComputer
7575

7676
if ($PSBoundParameters['Credential'])
7777
{
78+
Write-Verbose "[$FunctionName] Found Credential Parameter"
7879
$ContextSplatting.Credential = $Credential
7980
}
8081
if ($PSBoundParameters['DomainName'])
8182
{
83+
Write-Verbose "[$FunctionName] Found DomainName Parameter"
8284
$ContextSplatting.DomainName = $DomainName
8385
}
8486

src/public/Get-ADSIDomain.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@
6262
$Splatting = @{ }
6363
if ($PSBoundParameters['Credential'])
6464
{
65+
Write-Verbose "[$FunctionName] Found Credential Parameter"
6566
$Splatting.Credential = $Credential
6667
}
6768
if ($PSBoundParameters['DomainName'])
6869
{
70+
Write-Verbose "[$FunctionName] Found Credential Parameter"
6971
$Splatting.DomainName = $DomainName
7072
}
7173

src/public/Get-ADSIDomainController.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@
4444

4545
if ($PSBoundParameters['Credential'])
4646
{
47+
Write-Verbose "[$FunctionName] Found Credential Parameter"
4748
$Context = New-ADSIDirectoryContext -Credential $Credential -contextType Domain
4849
if ($PSBoundParameters['DomainName'])
49-
{
50+
{
51+
Write-Verbose "[$FunctionName] Found DomainName Parameter"
5052
$Context = New-ADSIDirectoryContext -Credential $Credential -contextType Domain -DomainName $DomainName
5153
}
5254
}
@@ -55,6 +57,7 @@
5557
$Context = New-ADSIDirectoryContext -contextType Domain
5658
if ($PSBoundParameters['DomainName'])
5759
{
60+
Write-Verbose "[$FunctionName] Found DomainName Parameter"
5861
$Context = New-ADSIDirectoryContext -contextType Domain -DomainName $DomainName
5962
}
6063
}
@@ -63,4 +66,4 @@
6366
{
6467
[System.DirectoryServices.ActiveDirectory.DomainController]::FindAll($Context)
6568
}
66-
}
69+
}

0 commit comments

Comments
 (0)