Skip to content

Commit

Permalink
Add some missing explicit parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
lazywinadmin committed Oct 7, 2018
1 parent 5469c9c commit 053623a
Show file tree
Hide file tree
Showing 31 changed files with 69 additions and 69 deletions.
4 changes: 2 additions & 2 deletions AdsiPS/Public/Get-ADSIComputer.ps1
Expand Up @@ -45,7 +45,7 @@ function Get-ADSIComputer
.EXAMPLE
$Comp = Get-ADSIComputer -Identity 'SERVER01'
$Comp.GetUnderlyingObject()| select-object *
$Comp.GetUnderlyingObject()| Select-Object -Property *
Help you find all the extra properties
Expand Down Expand Up @@ -91,7 +91,7 @@ function Get-ADSIComputer
}
ELSE{
$ComputerPrincipal = New-object -TypeName System.DirectoryServices.AccountManagement.ComputerPrincipal -ArgumentList $Context
$Searcher = new-object System.DirectoryServices.AccountManagement.PrincipalSearcher
$Searcher = new-object -TypeName System.DirectoryServices.AccountManagement.PrincipalSearcher
$Searcher.QueryFilter = $ComputerPrincipal

$Searcher.FindAll()
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIComputerSite.ps1
Expand Up @@ -85,7 +85,7 @@ public static class NetApi32 {
SiteName = [NetApi32]::DsGetSiteName($Computer)
}

New-Object -Type PSObject -property $Properties
New-Object -TypeName PSObject -property $Properties
}
CATCH
{
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIDomain.ps1
Expand Up @@ -56,7 +56,7 @@
{
IF ($PSBoundParameters['Credential'] -or $PSBoundParameters['DomainName'])
{
Write-Verbose '[PROCESS] Credential or DomainName specified'
Write-Verbose -Message '[PROCESS] Credential or DomainName specified'
$Splatting = @{ }
IF ($PSBoundParameters['Credential']) { $Splatting.Credential = $Credential }
IF ($PSBoundParameters['DomainName']) { $Splatting.DomainName = $DomainName }
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIDomainMode.ps1
Expand Up @@ -43,7 +43,7 @@
{
IF ($PSBoundParameters['Credential'] -or $PSBoundParameters['DomainName'])
{
Write-Verbose '[PROCESS] Credential or DomainName specified'
Write-Verbose -Message '[PROCESS] Credential or DomainName specified'
$Splatting = @{ }
IF ($PSBoundParameters['Credential']) { $Splatting.Credential = $Credential }
IF ($PSBoundParameters['DomainName']) { $Splatting.DomainName = $DomainName }
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIDomainTrustRelationship.ps1
Expand Up @@ -59,7 +59,7 @@
{
IF ($PSBoundParameters['Credential'] -or $PSBoundParameters['DomainName'])
{
Write-Verbose '[PROCESS] Credential or FirstName specified'
Write-Verbose -Message '[PROCESS] Credential or FirstName specified'
$Splatting = @{ }
IF ($PSBoundParameters['Credential']) { $Splatting.Credential = $Credential }
IF ($PSBoundParameters['DomainName']) { $Splatting.DomainName = $DomainName }
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIForest.ps1
Expand Up @@ -55,7 +55,7 @@
{
IF ($PSBoundParameters['Credential'] -or $PSBoundParameters['ForestName'])
{
Write-Verbose "[PROCESS] Credential or FirstName specified"
Write-Verbose -Message "[PROCESS] Credential or FirstName specified"
$Splatting = @{ }
IF ($PSBoundParameters['Credential']) { $Splatting.Credential = $Credential }
IF ($PSBoundParameters['ForestName']) { $Splatting.ForestName = $ForestName }
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIForestDomain.ps1
Expand Up @@ -49,7 +49,7 @@
{
IF ($PSBoundParameters['Credential'] -or $PSBoundParameters['ForestName'])
{
Write-Verbose '[PROCESS] Credential or FirstName specified'
Write-Verbose -Message '[PROCESS] Credential or FirstName specified'
$Splatting = @{ }
IF ($PSBoundParameters['Credential']) { $Splatting.Credential = $Credential }
IF ($PSBoundParameters['ForestName']) { $Splatting.ForestName = $ForestName }
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIForestMode.ps1
Expand Up @@ -56,7 +56,7 @@
{
IF ($PSBoundParameters['Credential'] -or $PSBoundParameters['ForestName'])
{
Write-Verbose '[PROCESS] Credential or FirstName specified'
Write-Verbose -Message '[PROCESS] Credential or FirstName specified'
$Splatting = @{ }
IF ($PSBoundParameters['Credential']) { $Splatting.Credential = $Credential }
IF ($PSBoundParameters['ForestName']) { $Splatting.ForestName = $ForestName }
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIForestTrustRelationship.ps1
Expand Up @@ -57,7 +57,7 @@
{
TRY
{
Write-Verbose '[Get-ADSIForestTrustRelationship][PROCESS] Credential or FirstName specified'
Write-Verbose -Message '[Get-ADSIForestTrustRelationship][PROCESS] Credential or FirstName specified'
(Get-ADSIForest @PSBoundParameters).GetAllTrustRelationships()
}
CATCH
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIFsmo.ps1
Expand Up @@ -101,7 +101,7 @@
PdcRoleOwner = $Domain.PdcRoleOwner
}

New-Object -Type PSObject -property $Properties
New-Object -TypeName PSObject -property $Properties

}
CATCH
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIGlobalCatalog.ps1
Expand Up @@ -46,7 +46,7 @@
{
TRY
{
Write-Verbose '[Get-ADSIGlobalCatalog][PROCESS] Credential or FirstName specified'
Write-Verbose -Message '[Get-ADSIGlobalCatalog][PROCESS] Credential or FirstName specified'
(Get-ADSIForest @PSBoundParameters).GlobalCatalogs
}
CATCH
Expand Down
12 changes: 6 additions & 6 deletions AdsiPS/Public/Get-ADSIGroup.ps1
Expand Up @@ -75,7 +75,7 @@ function Get-ADSIGroup
.EXAMPLE
$Comp = Get-ADSIGroup -Identity 'Finance'
$Comp.GetUnderlyingObject()| select-object *
$Comp.GetUnderlyingObject()| Select-Object -Property *
Help you find all the extra properties of the Finance group object
Expand Down Expand Up @@ -161,12 +161,12 @@ function Get-ADSIGroup
{
IF ($Identity)
{
Write-Verbose "Identity"
Write-Verbose -Message "Identity"
[System.DirectoryServices.AccountManagement.GroupPrincipal]::FindByIdentity($Context, $Identity)
}
ELSEIF ($PSBoundParameters['LDAPFilter'])
{
Write-Verbose "LDAPFilter"
Write-Verbose -Message "LDAPFilter"

# Directory Entry object
$DirectoryEntryParams = $ContextSplatting
Expand All @@ -179,17 +179,17 @@ function Get-ADSIGroup
$DirectorySearcher.Filter = "(&(objectCategory=group)$LDAPFilter)"


$DirectorySearcher.FindAll() | ForEach-Object {
$DirectorySearcher.FindAll() | Foreach-Object -Process {
[System.DirectoryServices.AccountManagement.GroupPrincipal]::FindByIdentity($Context, ($_.path -replace 'LDAP://'))
}
}
ELSE
{
Write-Verbose "Other Filters"
Write-Verbose -Message "Other Filters"

$GroupPrincipal = New-object -TypeName System.DirectoryServices.AccountManagement.GroupPrincipal -ArgumentList $Context
#$GroupPrincipal.Name = $Identity
$searcher = new-object System.DirectoryServices.AccountManagement.PrincipalSearcher
$searcher = new-object -TypeName System.DirectoryServices.AccountManagement.PrincipalSearcher
$searcher.QueryFilter = $GroupPrincipal
if ($PSBoundParameters['IsSecurityGroup']) { $searcher.QueryFilter.IsSecurityGroup = $IsSecurityGroup}
if ($PSBoundParameters['GroupScope']) { $searcher.QueryFilter.GroupScope = $GroupScope }
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIGroupMember.ps1
Expand Up @@ -61,7 +61,7 @@ function Get-ADSIGroupMember
.EXAMPLE
$Comp = Get-ADSIGroupMember -Identity 'SERVER01'
$Comp.GetUnderlyingObject()| select-object *
$Comp.GetUnderlyingObject()| Select-Object -Property *
Help you find all the extra properties
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIPrintQueue.ps1
Expand Up @@ -168,7 +168,7 @@
IF (-not$PSBoundParameters['NoResultLimit'])
{
$Search.SizeLimit = $SizeLimit
Write-warning "Result is limited to $SizeLimit entries, specify a specific number on the parameter SizeLimit or use -NoResultLimit switch to remove the limit"
Write-Warning -Message "Result is limited to $SizeLimit entries, specify a specific number on the parameter SizeLimit or use -NoResultLimit switch to remove the limit"
}
ELSE
{
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSIReplicaDomainInfo.ps1
Expand Up @@ -74,7 +74,7 @@
$dc.domain
if ($Recurse.IsPresent)
{
$dc.domain.children | ForEach-Object { $_ }
$dc.domain.children | Foreach-Object -Process { $_ }
}

}
Expand Down
4 changes: 2 additions & 2 deletions AdsiPS/Public/Get-ADSIReplicaInfo.ps1
Expand Up @@ -189,7 +189,7 @@
}
$domainDN = ""
$obj = $domain.Replace(',', '\,').Split('/')
$obj[0].split(".") | ForEach-Object { $domainDN += ",DC=" + $_ }
$obj[0].split(".") | Foreach-Object -Process { $domainDN += ",DC=" + $_ }
$domainDN = $domainDN.Substring(1)

if ($Cursors.IsPresent)
Expand All @@ -204,7 +204,7 @@
{
Write-Verbose -Message "Replication cursors for partition $partition on $($dc.Name)"

$dc.GetReplicationCursors($partition) | ForEach-Object { $_ }
$dc.GetReplicationCursors($partition) | Foreach-Object -Process { $_ }

}
}
Expand Down
4 changes: 2 additions & 2 deletions AdsiPS/Public/Get-ADSISchema.ps1
Expand Up @@ -68,7 +68,7 @@
{
IF ($PSBoundParameters['Credential'] -or $PSBoundParameters['ForestName'])
{
Write-Verbose '[PROCESS] Credential or ForestName specified'
Write-Verbose -Message '[PROCESS] Credential or ForestName specified'
$Splatting = @{ }
IF ($PSBoundParameters['Credential']) { $Splatting.Credential = $Credential }
IF ($PSBoundParameters['ForestName']) { $Splatting.ForestName = $ForestName}
Expand All @@ -94,7 +94,7 @@
}
IF ($PSBoundParameters['FindClassName'])
{
$schema.FindAllClasses() | Where-Object { $_.name -match $FindClassName } | Select-Object -Property Name
$schema.FindAllClasses() | Where-Object -FilterScript { $_.name -match $FindClassName } | Select-Object -Property Name
}

ELSE
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Get-ADSITokenGroup.ps1
Expand Up @@ -91,7 +91,7 @@
FOREACH ($Token in $($AccountGetDirectory.Get("tokenGroups")))
{
# Create SecurityIdentifier to translate into group name
$Principal = New-Object System.Security.Principal.SecurityIdentifier($token, 0)
$Principal = New-Object -TypeName System.Security.Principal.SecurityIdentifier($token, 0)

# Prepare Output
$Properties = @{
Expand Down
14 changes: 7 additions & 7 deletions AdsiPS/Public/Get-ADSIUser.ps1
Expand Up @@ -75,7 +75,7 @@ function Get-ADSIUser
.EXAMPLE
$user = Get-ADSIUser -Identity 'testaccount'
$user.GetUnderlyingObject()| select-object *
$user.GetUnderlyingObject()| Select-Object -Property *
Help you find all the extra properties and methods available
Expand Down Expand Up @@ -128,7 +128,7 @@ function Get-ADSIUser
{
IF ($Identity)
{
Write-Verbose "Identity"
Write-Verbose -Message "Identity"
[System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($Context, $Identity)

}
Expand All @@ -147,26 +147,26 @@ function Get-ADSIUser
$DirectorySearcher.Filter = "(&(objectCategory=user)$LDAPFilter)"
#$DirectorySearcher.PropertiesToLoad.AddRange("'Enabled','SamAccountName','DistinguishedName','Sid','DistinguishedName'")

if(-not$PSBoundParameters['NoResultLimit']){Write-warning "Result is limited to 1000 entries, specify a specific number on the parameter SizeLimit or 0 to remove the limit"}
if(-not$PSBoundParameters['NoResultLimit']){Write-Warning -Message "Result is limited to 1000 entries, specify a specific number on the parameter SizeLimit or 0 to remove the limit"}
else{
# SizeLimit is useless, even if there is a$Searcher.GetUnderlyingSearcher().sizelimit=$SizeLimit
# the server limit is kept
$DirectorySearcher.PageSize = 10000
}

$DirectorySearcher.FindAll() | ForEach-Object {
$DirectorySearcher.FindAll() | Foreach-Object -Process {
[System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($Context, $_.Properties["distinguishedname"])
}# Return UserPrincipale object
}
ELSE
{
Write-Verbose "Searcher"
Write-Verbose -Message "Searcher"

$UserPrincipal = New-object -TypeName System.DirectoryServices.AccountManagement.UserPrincipal -ArgumentList $Context
$Searcher = new-object System.DirectoryServices.AccountManagement.PrincipalSearcher
$Searcher = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalSearcher
$Searcher.QueryFilter = $UserPrincipal

if(-not$PSBoundParameters['NoResultLimit']){Write-warning "Result is limited to 1000 entries, specify a specific number on the parameter SizeLimit or 0 to remove the limit"}
if(-not$PSBoundParameters['NoResultLimit']){Write-Warning -Message "Result is limited to 1000 entries, specify a specific number on the parameter SizeLimit or 0 to remove the limit"}
else {
# SizeLimit is useless, even if there is a$Searcher.GetUnderlyingSearcher().sizelimit=$SizeLimit
# the server limit is kept
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/New-ADSIUser.ps1
Expand Up @@ -147,7 +147,7 @@
IF ($PSBoundParameters['HomeDrive']) { $user.HomeDrive = $HomeDrive }
IF ($PSBoundParameters['MiddleName']) { $user.MiddleName = $MiddleName }
IF ($PSBoundParameters['VoiceTelephoneNumber']) { $user.VoiceTelephoneNumber }
IF ($PSBoundParameters['AccountPassword']){$User.SetPassword((New-Object PSCredential "user",$AccountPassword).GetNetworkCredential().Password)}
IF ($PSBoundParameters['AccountPassword']){$User.SetPassword((New-Object -TypeName PSCredential -ArgumentList "user",$AccountPassword).GetNetworkCredential().Password)}

Write-Verbose -message "Create the Account in Active Directory"
$User.Save($Context)
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Set-ADSIUserPassword.ps1
Expand Up @@ -68,7 +68,7 @@
{
if ($pscmdlet.ShouldProcess("$Identity", "Change Account Password"))
{
(Get-ADSIUser -Identity $Identity @ContextSplatting).SetPassword((New-Object PSCredential "user",$AccountPassword).GetNetworkCredential().Password)
(Get-ADSIUser -Identity $Identity @ContextSplatting).SetPassword((New-Object -TypeName PSCredential -ArgumentList "user",$AccountPassword).GetNetworkCredential().Password)
}
}
CATCH
Expand Down
2 changes: 1 addition & 1 deletion AdsiPS/Public/Test-ADSICredential.ps1
Expand Up @@ -73,7 +73,7 @@ function Test-ADSICredential
TRY
{
Write-Verbose -Message "[Test-ADSICredential][PROCESS] Validating $AccountName Credential against $($Context.ConnectedServer)"
$Context.ValidateCredentials($AccountName, (New-Object PSCredential "user",$AccountPassword).GetNetworkCredential().Password)
$Context.ValidateCredentials($AccountName, (New-Object -TypeName PSCredential -ArgumentList "user",$AccountPassword).GetNetworkCredential().Password)
}
CATCH
{
Expand Down

0 comments on commit 053623a

Please sign in to comment.