Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Nick Shores nshores

🏠
Working from home
Block or report user

Report or block nshores

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nshores
nshores / failed_logins.ps1
Last active Jul 30, 2019
failed_windows_logins.ps1
View failed_logins.ps1
$a = Get-EventLog -LogName 'Security' -InstanceId 4776 | select ReplacementStrings
$array = @()
foreach ($b in $a) {
$array += $($b[0].ReplacementStrings)[1]
}
Write-Output $array
Write-Output "Final Count"$array.Count
$array | out-file fail.csv
@nshores
nshores / nest_grafana_polling.py
Created Jul 19, 2019
nest_grafana_polling.py
View nest_grafana_polling.py
import nest
#https://github.com/jkoelker/python-nest
import sys
from influxdb import client as influxdb
db = influxdb.InfluxDBClient("localhost", 8086, "", "", "cacti2")
client_id = 'xx'
client_secret = 'xx'
@nshores
nshores / rubrik_sla_report.ps1
Last active Jul 16, 2019
Rubrik SLA Report
View rubrik_sla_report.ps1
#Rubrik SLA Report
# Possible Frequencies - $@{daily=; weekly=; monthly=; yearly=}
$server = '10.1.204.50'
$username = 'admin'
$password = ''
connect-rubrik -server $server -Username $username -Password $password
@nshores
nshores / rubrik_bootstrap_request.ps1
Last active Jul 15, 2019
rubrik_bootstrap_request.ps1
View rubrik_bootstrap_request.ps1
#New-RubrikBootStrap Documentation
#Example Usage --
#IPV4 Locally Assigned Link Address (169.254.x.x)
#Can also use MDNS name - IE VRVW564D3A0BC.local
$server = '169.254.11.25'
$name = 'RubrikEdge'
#Must Be an array even if you only have 1 server
$management_dns = @(
View get_ad_Group.ps1
$Groups = (Get-AdGroup -filter * | Where {$_.name -like "**"} | select name -ExpandProperty name)
$Table = @()
$Record = @{
"Group Name" = ""
"Name" = ""
"Username" = ""
}
View sql_log_monitor.ps1
#SQL Log monitor script
# http://ramblingcookiemonster.github.io/SQLite-and-PowerShell/
#Query DB, Select any events that match error code 3047 in last 5 minutes. If any match, restart service, else do nothing.
$database = '.\log.db3'
[datetime]$enddate = Get-Date -Format f
$startdate = $date.AddMinutes(-5)
#Query the DB
@nshores
nshores / azure_gw_ipsec_setup.ps1
Created Apr 19, 2019
azure_gw_ipsec_setup.ps1
View azure_gw_ipsec_setup.ps1
#default to msdn sub
Set-AzContext -Subscription "716f03d6-acff-467c-bca4-3c8eb56f549d"
# https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-tutorial-create-gateway-powershell
##Notes
10.1.220.0/23 ## Address Space
10.1.220.0/24 ## Frontend
10.1.221.0/24 ## Backend
@nshores
nshores / powercli_upload_to_ds
Created Apr 9, 2019
upload iso to datastore
View powercli_upload_to_ds
#upload iso to datastore
$datastore = Get-Datastore "PK-VOL-01"
New-PSDrive -Location $datastore -Name ds -PSProvider VimDatastore -Root "\"
Copy-DatastoreItem -Item c:\users\dsatech\2016.iso -Destination ds:\
View wash_dry_sensor.yaml
sensor:
- platform: template
sensors:
wash_power:
friendly_name: "Current Wash Power"
unit_of_measurement: "W"
value_template: "{{ states.switch.zigbee_outlet.attributes.current_power_w }}"
washing_machine_status:
value_template: '{{ states.input_select.washing_machine_status.state}}'
friendly_name: 'Washing Machine Status'
View Untitled-13
Param (
[string]$Printservers = "oldPrintServer"
)
# Create new Excel workbook
cls
$Excel = New-Object -ComObject Excel.Application
$Excel.Visible = $True
$Excel = $Excel.Workbooks.Add()
$Sheet = $Excel.Worksheets.Item(1)
You can’t perform that action at this time.