Skip to content

Instantly share code, notes, and snippets.

View nshores's full-sized avatar
🏠
Working from home

Nick Shores nshores

🏠
Working from home
View GitHub Profile
@nshores
nshores / onkyo_reboot.py
Last active October 8, 2018 23:40
onkyo_reboot.py
#Reboot receiver when eISCP commands fail
#https://github.com/miracle2k/onkyo-eiscp
import eiscp
import requests
import time
import urllib
from influxdb import InfluxDBClient
#Define influxdb stuff
host='192.168.99.118'
Steps for X11 forwarding with OSX -
Install Xquartx with Homebrew --
brew cask install xquartz
Set preferences for xquartz
open -a XQuartz. In the XQuartz preferences, go to the “Security” tab and make sure you’ve got “Allow connections from network clients” ticked:
Use xhost on remote machine to allow access to local client for x11 forwarding
xhost + 1.1.1.1 (SSH client ip)
Set env variable on remote machine to local ssh client ip
env DISPLAY=1.1.1.1:0
@nshores
nshores / restart-service.ps1
Created October 30, 2018 22:21
restart-service.ps1
#define list of computers, this is just a simple array but you could also feed it a csv with
# $computers = import-csv 'yourcsvname.csv'
$computers = ‘pkw7-erice’,’pkw7-test’
foreach ($c in $computers){
#stop Service
write-host "Stopping Kace service on $c"
get-service -ComputerName $c | ? {$_.Name -like "*konea*"} | Set-Service -Status stopped
#start service
write-host "Starting Kace service on $c"
@nshores
nshores / comp_report.ps1
Last active October 31, 2018 18:51
comp_report.ps1
$computers = Get-ADComputer -Filter * -Property * | Select-Object Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion -first 20
$CompCollection=@()
foreach ($c in $computers){
#define custom object
write-host "Checking $($c.name)"
$CompCurrent = New-Object -TypeName psobject
$CompCurrent | Add-Member -MemberType NoteProperty -Name ComputerName -Value ""
@nshores
nshores / backup_pa_config.ps1
Created December 3, 2018 23:13
backup_pa_config.ps1
#Disable SSL Cert Check
if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type)
{
$certCallback = @"
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public class ServerCertificateValidationCallback
{
@nshores
nshores / onkyo_grafana_dashboard.json
Created December 6, 2018 18:33
onkyo_grafana_dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@nshores
nshores / vm-dns.ps1
Last active December 20, 2018 21:44
vm-dns.ps1
$iplist = import-csv /Users/nshores/Documents/USA Properties/vms122018.csv
$guestcred = Get-Credential
$CompCollection=@()
$code = @'
$dns = Get-NetIPConfiguration | Select-Object -ExpandProperty DnsServer | select ServerAddresses
$dns.serveraddresses
'@
@nshores
nshores / update_dns_ip.ps1
Created December 20, 2018 22:15
update_dns_ip.ps1
$Computerlist = get-content "\\vmware-host\Shared Folders\Documents\RGA\dns_server_updates.txt"
$dnsservers =@("192.168.0.9","192.168.0.12")
$cred = Get-Credential rga.local\it-services
foreach ($computername in $computerlist) {
$result = get-wmiobject win32_pingstatus -filter "address='$computername'"
if ($result.statuscode -eq 0) {
$remoteNic = get-wmiobject -class win32_networkadapter -computer $computername -Credential $cred | where-object {$_.Name -eq "vmxnet3 Ethernet Adapter"}
$index = $remotenic.index
$DNSlist = $(get-wmiobject win32_networkadapterconfiguration -computer $computername -Credential $cred -Filter ‘IPEnabled=true’ | where-object {$_.index -eq $index}).dnsserversearchorder
@nshores
nshores / ansible_junos_update_dhcp.yaml
Last active January 9, 2019 05:12
ansible_junos_update_dhcp
#Update configuraton for DHCP on Junos 12.x devices
#Nick Shores 1-8-2018 - Created for WRA
---
- hosts: wra
gather_facts: no
connection: local
roles:
- Juniper.junos
@nshores
nshores / Untitled-13
Created January 11, 2019 00:10
printer_info.ps1
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)