first commit
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*LegmanTeamBenzoin!!*
|
||||
|
||||
powershell -ep bypass
|
||||
|
||||
$group = LDAPSearch -LDAPQuery "(&(objectCategory=group)(cn=Customer support*))"
|
||||
```powershell
|
||||
$PDC = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().PdcRoleOwner.Name
|
||||
$DN = ([adsi]'').distinguishedName
|
||||
$LDAP = "LDAP://$PDC/$DN"
|
||||
|
||||
$direntry = New-Object System.DirectoryServices.DirectoryEntry($LDAP)
|
||||
|
||||
$dirsearcher = New-Object System.DirectoryServices.DirectorySearcher($direntry)
|
||||
$dirsearcher.filter="samAccountType=805306368"
|
||||
$dirsearcher.FindAll()
|
||||
Foreach($obj in $result)
|
||||
{
|
||||
Foreach($prop in $obj.Properties)
|
||||
{
|
||||
$prop
|
||||
}
|
||||
|
||||
Write-Host "-------------------------------"
|
||||
}
|
||||
$dirsearcher = New-Object System.DirectoryServices.DirectorySearcher($direntry)
|
||||
$dirsearcher.filter="name=michelle"
|
||||
$result = $dirsearcher.FindAll()
|
||||
|
||||
Foreach($obj in $result)
|
||||
{
|
||||
Foreach($prop in $obj.Properties)
|
||||
{
|
||||
$prop.memberof
|
||||
}
|
||||
|
||||
Write-Host "-------------------------------"
|
||||
}
|
||||
```
|
||||
|
||||
```powershell
|
||||
function LDAPSearch {
|
||||
param (
|
||||
[string]$LDAPQuery
|
||||
)
|
||||
|
||||
$PDC = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().PdcRoleOwner.Name
|
||||
$DistinguishedName = ([adsi]'').distinguishedName
|
||||
|
||||
$DirectoryEntry = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$PDC/$DistinguishedName")
|
||||
|
||||
$DirectorySearcher = New-Object System.DirectoryServices.DirectorySearcher($DirectoryEntry, $LDAPQuery)
|
||||
|
||||
return $DirectorySearcher.FindAll()
|
||||
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user