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
if(test-path C:\chef\){ | |
Write-Host "C:\chef exists!" | |
Start-Sleep -Seconds 3600 | |
} | |
Set-ExecutionPolicy unrestricted -force | |
$VerbosePreference = 'continue' | |
$InstallPS1 = "https://omnitruck.chef.io/install.ps1" | |
$InstallPS1LocalPath = "$env:temp\install-chef.ps1" | |
$orgName = 'CHEF ORG NAME' | |
$ChefPackageUri = 'https://packages.chef.io/files/stable/chef/12.21.31/windows/2012r2/chef-client-12.21.31-1-x64.msi' |
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
{ | |
"annotations": { | |
"list": [ | |
{ | |
"$$hashKey": "object:1373", | |
"builtIn": 1, | |
"datasource": "-- Grafana --", | |
"enable": true, | |
"hide": true, | |
"iconColor": "rgba(0, 211, 255, 1)", |
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
from pyzabbix import ZabbixAPI | |
import os | |
import json | |
import logging, sys | |
from pprint import pprint | |
# | |
# | |
# WARNING | |
# THIS |
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
import boto3 | |
from datetime import datetime | |
import logging | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
def lambda_handler(event, context): |
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
$ElasticSearchURL = 'https://<elasticsearchurl>:<port>' | |
$indices = (iwr "$ElasticSearchURL/_cat/indices?format=json&pretty").content | ConvertFrom-Json | |
$indices.Index | ?{$_ -match '\d{4}\.\d\d\.\d\d$'} | sort | |
$IndicesWithDate = $indices | ?{$_.index -like '*beat-*'} | select index,@{L="Date";E={get-date ($_.index -split '-')[1]}} | |
$indicesToDelete = $IndicesWithDate | ?{$_.date -lt (Get-Date).AddDays(-7)} | |
foreach($index in $indicesToDelete){ | |
$index.index | |
iwr "$ElasticSearchURL/$($index.index)" -Method delete |
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
$ProfileNames = @( | |
"Profile1", | |
"Profile2" | |
) | |
foreach($Profile in $ProfileNames){ | |
Set-AWSCredential -ProfileName $Profile | |
$StartTime = (Get-Date).AddDays(-30) | |
$EndTime = (Get-Date) |
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
$Env:AWSAccountID = "ACCOUNTID" | |
$Env:SourceRegion = "eu-central-1" | |
$ENV:DestinationRegion = "eu-west-1" | |
$env:AgeOfSnapshotsDays=1 | |
$SourceSnapshots = Get-EC2Snapshot -region $Env:SourceRegion -OwnerId $Env:AWSAccountID | |
$SourceFiltered = $SourceSnapshots | ?{$_.starttime -gt (get-date).AddDays(-1*$env:AgeOfSnapshotsDays)} | |
Write-Verbose "Found $($SourceFiltered.count) snapshots to copy from $Env:SourceRegion to $Env:DestinationRegion" |
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
Rename-Computer -NewName $newComputerName | |
Add-Computer -Credential $Credentials -DomainName 'SDLPRODUCTS.com' -Force -Options JoinWithNewName,AccountCreate |
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 Format-AnsiColor { | |
[CmdletBinding()] | |
[OutputType([String])] | |
param( | |
[Parameter( | |
Mandatory = $true, | |
ValueFromPipeline = $true | |
)] | |
[AllowEmptyString()] | |
[String] |
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
$Ips = @("192.168.1.1") | |
foreach($Region in $(Get-AWSRegion).Region){ | |
$SecurityGroupsContainingRDP = Get-EC2SecurityGroup -region $Region| ?{$_.ippermission.FromPort -eq 3389} | |
Foreach($SecurityGroup in $SecurityGroupsContainingRDP){ | |
Write-Verbose "Adding WinRM to $($SecurityGroup.GroupID)" | |
try{ | |
Grant-EC2SecurityGroupIngress -GroupId $SecurityGroup.GroupId -region $Region -IpPermission @{IpProtocol="TCP";FromPort=5985;ToPort=5986;IPRanges=$IPs} | |
}catch{ | |
if($_.exception.message -like "*already exists*"){ | |
Write-Verbose "`tRule already exists" |