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
$mon = [System.DayOfWeek]::Monday
$tue = [System.DayOfWeek]::Tuesday
$wed = [System.DayOfWeek]::Wednesday
$thu = [System.DayOfWeek]::Thursday
$fri = [System.DayOfWeek]::Friday
Set-OBMachineSetting -WorkDay $mon, $tue, $wed, $thu, $fri -StartWorkHour "7:00:00" -EndWorkHour "22:00:00" -WorkHourBandwidth (10000*1024) -NonWorkHourBandwidth (90000*1024)
#### EDIT ME
$newprofilepath = "\\adcfs01\profiledisks\"
$skip = "admin","administrator","ontimetech","adc","old","temp","automate","public","NerdioAdministrator@ADC.local","nerdioadmin","ontimetech.ADC"
#### Don't edit me
$ENV:PATH=”$ENV:PATH;\\Pool-A000005.adc.local\c$\Program Files\FSLogix\Apps”
$oldprofiles = gci c:\users | Sort-Object LastWriteTime -Descending | select -expand fullname -First 2
@nshores
nshores / failed_logins.ps1
Last active July 30, 2019 23:47
failed_windows_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 July 19, 2019 22:51
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 July 16, 2019 00:15
Rubrik SLA Report
#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 July 15, 2019 19:19
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 = @(
@nshores
nshores / get_ad_Group.ps1
Created May 31, 2019 18:41
get_ad_Group.ps1
$Groups = (Get-AdGroup -filter * | Where {$_.name -like "**"} | select name -ExpandProperty name)
$Table = @()
$Record = @{
"Group Name" = ""
"Name" = ""
"Username" = ""
}
@nshores
nshores / sql_log_monitor.ps1
Created April 25, 2019 21:26
sql_log_monitor
#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 April 19, 2019 18:22
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 April 9, 2019 20:31
upload iso to datastore
#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:\