This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * INTO C:\TEMP\Output\output.csv | |
FROM C:\TEMP\Logs\* | |
WHERE TimeWritten > TIMESTAMP ( '2009-01-01 01:00:00', 'yyyy-MM-dd hh:mm:ss' ) AND SourceName = 'Microsoft-Windows-Security-Auditing' AND | |
( Strings LIKE '%jon%' OR strings LIKE '%dave%') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * INTO C:\TEMP\Output\output.csv | |
FROM \\DC01.OHOLICS.NET\security;\\DC02.OHOLICS.NET\security;\\DC03.OHOLICS.NET\security | |
WHERE TimeWritten > TIMESTAMP ( '2009-01-01 01:00:00', 'yyyy-MM-dd hh:mm:ss' ) AND SourceName = 'Microsoft-Windows-Security-Auditing' AND | |
( Strings LIKE '%jon%' OR strings LIKE '%dave%') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * INTO C:\TEMP\Output\output.csv | |
FROM \\DC01.OHOLICS.NET\security | |
WHERE TimeWritten > TIMESTAMP ( '2009-01-01 01:00:00', 'yyyy-MM-dd hh:mm:ss' ) AND SourceName = 'Microsoft-Windows-Security-Auditing' AND | |
( Strings LIKE '%jon%' OR strings LIKE '%dave%') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
EventLog, | |
RecordNumber, | |
TimeGenerated, | |
TimeWritten, | |
EventID, | |
EventType, | |
EventTypeName, | |
EventCategory, | |
EventCategoryName, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-AzureRmAccount | |
$Subscription = "<Subscription-GUID>" | |
$LogFile = "C:\<PATH>\NSGs.csv" | |
If (Test-Path $Logfile) { | |
Clear-Content -Path $Logfile | |
} | |
Add-Content $LogFile "nsg,rule,protocol,SourcePortRange,DestinationPortRange,SourceAddressPrefix,DestinationAddressPrefix,SourceApplicationSecurityGroups,DestinationApplicationSecurityGroups,Access,Priority,Direction" | |
Set-AzureRmContext -Subscription $Subscription | |
$NSGs = Get-AzureRmNetworkSecurityGroup | |
foreach ($nsg in $NSGs) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-AzureRmAccount | |
$Subscription = "<Subscription-GUID>" | |
$LogFile = "C:\<PATH>\RouteTables.csv" | |
If (Test-Path $Logfile) { | |
Clear-Content -Path $Logfile | |
} | |
Add-Content $Logfile "Name,ResourceGroupName,Location,RouteName,Id,Etag,ProvisioningState,AddressPrefix,NextHopType,NextHopIpAddress" | |
Set-AzureRmContext -Subscription $Subscription | |
$RTs = Get-AzureRmRouteTable | |
ForEach ($RT in $RTs) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$TenantId = "<AzureADTenantID>" | |
$ApplicationId = "<AppID>" | |
$Cert=Get-ChildItem cert:\CurrentUser\My\"<CertificateThumbprint>" | |
# Connect to Azure AD: | |
Connect-AzureAD -TenantId $TenantId -ApplicationId $ApplicationId -CertificateThumbprint $Cert.Thumbprint | |
# e.g. Get-AzureADUsers | |
# Connect to AzureRM: | |
Connect-AzureRmAccount -CertificateThumbprint $Cert.Thumbprint -ApplicationId $ApplicationId -Tenant $TenantId -ServicePrincipal | |
# e.g. Get-AzureRMResourceGroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Subscription = "<Subscription-GUID>" | |
$ApplicationName = "<AppName>" | |
$ServicePrincipal = Get-AzureRMADServicePrincipal -DisplayName $ApplicationName | |
Set-AzureRmContext -Subscription $Subscription | |
$NewRole = $null | |
$Retries = 0; | |
While ($NewRole -eq $null -and $Retries -le 6) { | |
Sleep 15 | |
New-AzureRMRoleAssignment -ResourceGroupName -RoleDefinitionName Reader -ServicePrincipalName $ServicePrincipal.ApplicationId | Write-Verbose -ErrorAction SilentlyContinue | |
$NewRole = Get-AzureRMRoleAssignment -ObjectId $ServicePrincipal.Id -ErrorAction SilentlyContinue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Subscription = "<Subscription-GUID>" | |
$PathToPFXCertificate = "C:\<PATH>\<CertName>.pfx" | |
$PFXPassword = "<Password>" | |
$CertPassword = ConvertTo-SecureString $PFXPassword -AsPlainText -Force | |
$ApplicationName = "<AppName>" | |
Import-Module AzureRM.Resources | |
Connect-AzureRmAccount | |
Set-AzureRmContext -Subscription $Subscription | |
$PFXCert = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($PathToPFXCertificate, $CertPassword) | |
$KeyValue = [System.Convert]::ToBase64String($PFXCert.GetRawCertData()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# OpenSSL example configuration file. | |
# This is mostly being used for generation of certificate requests. | |
# | |
# This definition stops the following lines choking if HOME isn't | |
# defined. | |
HOME = . | |
RANDFILE = $ENV::HOME/.rnd |