This file contains hidden or 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
function Invoke-CancelAdoBuildsAndJobs | |
{ | |
param( | |
[Parameter()] | |
[ValidateNotNullOrEmpty()] | |
$AzureDevOpsPAT, | |
$OrganizationName, | |
$ProjectName | |
) |
This file contains hidden or 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
let timeframe = 1hr; | |
let userName = '<username without domain>'; | |
SecurityEvent | |
| where TimeGenerated >= ago(timeframe) | |
| where TargetUserName == (userName) | |
| where EventID == 4625 // bad login | |
| extend Reason = case( | |
SubStatus == '0xc000005e', 'No logon servers available to service the logon request', | |
SubStatus == '0xc0000062', 'Account name is not properly formatted', | |
SubStatus == '0xc0000064', 'Account name does not exist', |
This file contains hidden or 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
#!/bin/bash | |
restartWindowsAgents () { | |
local TEAMCITY_USER_NAME=$1 | |
local TEAMCITY_USER_SECRET=$2 | |
local TEAMCITY_TARGET_AGENTS="$3" | |
# teamcity root | |
TEAMCITY_URI='https://my.teamcity.local' | |
if [ -z "${TEAMCITY_TARGET_AGENTS}" ]; then |
This file contains hidden or 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
Function Get-RandomPort | |
{ | |
return Get-Random -Max 32767 -Min 30000; | |
} | |
Function Test-PortInUse | |
{ | |
Param( | |
[Parameter(Mandatory = $true)] | |
[Int] $portToTest |
This file contains hidden or 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
function Test-Port | |
{ | |
param | |
( | |
$Address, | |
$Port | |
) | |
$tcpClient = New-Object Net.Sockets.TcpClient | |
try | |
{ |
This file contains hidden or 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
# collect CE IP ranges | |
$AllCEIps = (Invoke-RestMethod https://my.cloudelements.io/ip-ranges.json).prefixes | |
# counter | |
[int] $Count = 0 | |
# CE Environment: staging / production | |
[string] $Environment = 'staging' | |
foreach ($a In $AllCEIps) | |
{ | |
# extract environment and ip |
This file contains hidden or 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
#Requires -module az.websites | |
param( | |
$AppName = 'cirrus-a' | |
) | |
$App = [ordered]@{ | |
AppName = $AppName | |
AAD_ID = $((Get-AzWebApp | Where-Object Name -EQ $AppName).Identity.PrincipalId) | |
HostName = $((Get-AzWebApp | Where-Object Name -EQ $AppName).DefaultHostName) | |
} |
This file contains hidden or 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
function Update-AllUserModules | |
{ | |
[cmdletbinding(SupportsShouldProcess = $True)] | |
param() | |
if ($PSCmdlet.ShouldProcess($env:COMPUTERNAME, 'Update all user modules')) | |
{ | |
(Get-InstalledModule).Name | ForEach-Object { | |
Write-Verbose "Updating module: $_" | |
try |
This file contains hidden or 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
function Test-PactEndpoint | |
{ | |
[cmdletbinding()] | |
param ( | |
[Parameter(Position=0)] | |
[string] $Uri, | |
[Parameter(Position=1)] | |
[int] $Retrycount = '3' | |
) |
This file contains hidden or 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
#!/bin/bash | |
## declare array | |
declare -a REQUIRED_PKGS=("dnsutils" "nano") | |
# iterate over array | |
for i in "${REQUIRED_PKGS[@]}"; | |
do | |
# if installed then remove | |
if [ "$(dpkg -l | grep $i)" ]; then | |
sudo apt-get purge --auto-remove ${i} -y #--simulate |
NewerOlder