<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">*[System[(EventID=4624)] and EventData[Data[@Name='LmPackageName']='NTLM V1']]</Select>
</Query>
</QueryList>
These are just random notes and programs that may have incomplete descriptions. Any scripts or programs use at your risk
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">*[System[(EventID=4624)] and EventData[Data[@Name='LmPackageName']='NTLM V1']]</Select>
</Query>
</QueryList>
Needed a script to export dhcp scope and scope id for a domain.
$report = @()
$DHCPServer = DHCPServerHostname
$scopes =Get-DhcpServerv4Scope -ComputerName $DHCPServer
foreach ($scope in $Scopes){
$scopeID = $scope.ScopeId
$report += Get-DhcpServerv4OptionValue -ScopeId $scopeID -ComputerName $DHCPServer |`
select @{name="ScopeID";e={$scopeID}},OptionID,Name,Type,@{Name="Value";e={$_.value -join ";"}
}
$report | export-csv -NoTypeInformation -path "c:\temp\DHCPScopeIDwithOption.csv"
$scopes | export-csv -NoTypeInformation -path "c:\temp\DHCPScopeIDwithMask.csv"
Wrote script so people specify the adfs server and the signature and encryption certificate will extract the certs to two files stored in c:\temp
# just put in the ADFS server name
$AdfsServer = 'adfs.microsoft.com'
[xml]$XmlDocument = (New-Object System.Net.WebClient).DownloadString("https://$AdfsServer/FederationMetadata/2007-06/FederationMetadata.xml")
#ADFS Signing Certificate
$Cert = $xmldocument.entitydescriptor.roledescriptor.keydescriptor | select Use,@{Name="x509"; Expression={(($_.keyinfo).X509data).x509certificate}}
#Sign Cert
$cert | ? {$_.use -eq "signing"} | select -ExpandProperty x509 | out-file c:\temp\Signcert.cer
#Encryption Cert
$cert | ? {$_.use -eq "encryption"} | select -ExpandProperty x509 | out-file c:\temp\Encryptioncert.cer
$Cert
List Certificate Templates
function get-CertificateTemplates {
[CmdletBinding()] Param (
[Parameter(Mandatory = $True, ValueFromPipelineByPropertyName = $True)]
[string]$forest
)
$DefaultPartition = Get-ADDomainController -Server $forest | select -expand DefaultPartition
$configcontext = "CN=Configuration,$($DefaultPartition)"
$ADSI = [ADSI]"LDAP://CN=Certificate Templates,CN=Public Key Services,CN=Services,$ConfigContext"
$ADSI.Children | Sort-Object Name | Select-Object DisplayName, Name, msPKI-Cert-Template-OID
}
List Certificate CDP info
function get-CertificateCDP {
[CmdletBinding()] Param (
[Parameter(Mandatory = $True, ValueFromPipelineByPropertyName = $True)]
[string]$forest
)
$DefaultPartition = Get-ADDomainController -Server $forest | select -expand DefaultPartition
$configcontext = "CN=Configuration,$($DefaultPartition)"
$ADSI = [ADSI]"LDAP://CN=cdp,CN=Public Key Services,CN=Services,$ConfigContext"
$ADSI.Children | select cn,Children,path
}
List Certificate Auhtorities in forest - requires activedirectory module
function get-CertificationAuthorities {
[CmdletBinding()] Param (
[Parameter(Mandatory = $True, ValueFromPipelineByPropertyName = $True)]
[string]$forest
)
$DefaultPartition = Get-ADDomainController -Server $forest | select -expand DefaultPartition
$configcontext = "CN=Configuration,$($DefaultPartition)"
$ADSI = [ADSI]"LDAP://CN=Certification Authorities,CN=Public Key Services,CN=Services,$ConfigContext"
$ADSI.Children | select name,whenCreated
}
.Synopsis
Get Active Directory replication report
DESCRIPTION
reports on replication issues
EXAMPLE
get-ADReplicationReport -domains "Domain1","Domain2"
function get-QrgADReplicationReport
{
[CmdletBinding()]
[Alias()]
[OutputType([int])]
Param
(
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
[string]$Server
)
Begin
{
}
Process
{
Get-ADReplicationPartnerMetadata -Target $server -Partition * | select `
Server,`
@{Name = 'Partner';Expression = {$_.Partner.split(",")[1].split("=")[1]}},`
Partition,`
LastReplicationSuccess,`
ConsecutiveReplicationFailures,`
PartnerType,`
PartnerAddress,`
PartnerGuid
}
End
{
}
}
function Get-DomainFSMO
{
[CmdletBinding()]
[OutputType([System.Management.ManagementObject])]
param
(
[parameter( Mandatory=$false,
ValueFromPipeline=$True,
Position = 0,
HelpMessage="An array of domains.",
ValueFromPipelineByPropertyName=$True)]
[String[]] $domain
)
begin{Write-Verbose "Getting Forest info for: $CurrentDomain"}
process{
foreach ($CurrentDomain in $domain){
$dom = @{
label="Domain"
expression = {$CurrentDomain}
}
Write-Verbose "Getting Forest info for: $CurrentDomain"
Get-ADDomain -Server $CurrentDomain | Select-Object $dom,InfrastructureMaster, RIDMaster, PDCEmulator,DomainMode,DomainSid
}
}
end{}
}
PowerShell Script Bulk add new roles to application registration in azure. Update $roles with ,Us...