Skip to content

Instantly share code, notes, and snippets.

View jbilinski's full-sized avatar

J Bilinski jbilinski

View GitHub Profile
@jbilinski
jbilinski / start-jenkins-agent-as-windows-scheduled-job.ps1
Last active August 5, 2024 02:58
bl-start-jenkins-agent-as-windows-scheduled-job
$buildnode='us-wa-bn-win-9' # name of the node as created in Jenkins
$jenkinsprimaryurl='https://na-jenkins-ha0.meta.dev' # (internal) URL of the Jenkins master
$javabin="$env:ProgramFiles\Java\jdk-21\bin\java.exe" # Path to the Java binary on windows
$workpath='c:\jenkins' # This is the path to the windows agent work directory
$agentpath="$($workpath)\agent" # I prefer to keep the agent in a subdirectory of the work directory
$jenksec='fakekey1234567890abcdef1234567890abcdef1234567890abcdef1234567890' # shared secret Jenkins creates for agent*
Register-ScheduledJob -Name jenkins-agent -ScriptBlock {
Start-Process $javabin -WindowStyle Hidden `
-RedirectStandardError "$($agentpath)\agent.log" `
@jbilinski
jbilinski / install-corp-ca-macos.sh
Last active August 5, 2024 05:46
MacOS shell script to install a new root CA and intermediate CAs
#!/bin/bash
# Ensure the script is run as root
((EUID != 0)) && exec sudo -- "$0" "$@"
cd /tmp/ &>/dev/null
clear
# Define the certificate URL and fingerprint
crturl="https://scriptops.corp/CertEnroll/"
rootfingerprint="00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF"
@jbilinski
jbilinski / CleariCalCache.sh
Last active September 13, 2017 19:50
Clear iCal or Apple Calendar Cache on MacOS
#!/bin/sh
kill $(pgrep Calendar)
rm ~/Library/Calendars/Calendar\ Cache*
/Applications/Calendar.app/Contents/MacOS/Calendar &

Keybase proof

I hereby claim:

  • I am jbilinski on github.
  • I am jbilinski (https://keybase.io/jbilinski) on keybase.
  • I have a public key ASC-hSASsTGd3WRgjeJYSlCZWku3B_TQH-6x6pgHDPqi7Ao

To claim this, I am signing this object:

@jbilinski
jbilinski / copy-dns-from-pfsense-unbound-to-windows-1.ps1
Last active October 8, 2019 04:42
copy-dns-from-pfsense-unbound-to-windows
#requires -Version 4.0 -Modules DnsServer
<#
.Synopsis
Copy Unbound DNS records from pfSense to MS DNS server
.DESCRIPTION
Facilitates movement from Unbound on pfSense to MS DNS services.
Function recreates A and CNAME records from pfSense backup in a MS Server DNS zone.
*Tested with pfSense version 2.3.2 and Server 2016
@jbilinski
jbilinski / powercli-new-vm-from-template-1.ps1
Created July 2, 2016 05:45
bl-powercli-new-vm-from-template
#requires -Version 1 -Modules VMware.VimAutomation.Core
$lsVMName = 'chi-syslog-1'
$lsSourceTemplate = Get-Template -Name 'oraclelinux7-minimal'
$lsDatastore = Get-Datastore -Name 'ds_vnxfl_3'
$lsCluster = 'cl_usilchi_1'
$lsDatacenter = 'dc_chi_l3_1'
$lsResourcePool = Get-ResourcePool -Location $lsCluster -Name 'rp_prod'
New-VM -Name $lsVMName -Template $lsSourceTemplate -Datastore $lsDatastore -ResourcePool $lsResourcePool
@jbilinski
jbilinski / clean-up-cbt-after-avamar-proxy-failure-1.ps1
Created July 2, 2016 05:31
bl-clean-up-cbt-after-avamar-proxy-failure
#requires -Version 4 -Modules VMware.VimAutomation.Core
#Find VMs that need consolidation
Get-VM | Where-Object -FilterScript {$_.Extensiondata.Runtime.ConsolidationNeeded}
@jbilinski
jbilinski / new-daily-password-and-a-cisco-guest-wireless-portal-1.ps1
Created July 2, 2016 01:37
bl-new-daily-password-and-a-cisco-guest-wireless-portal
#requires -Version 3
function Check-GuestEnvironment
{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)][string]$kiwiServer,
[Parameter(Mandatory = $true)][string]$webServer,
[Parameter(Mandatory = $true)][string]$webURL
)
@jbilinski
jbilinski / flush-stale-jabber-contact-cache-1.ps1
Created July 2, 2016 01:01
bl-flush-stale-jabber-contact-cache
Function Clear-JabberContactCache
{
#Fix bad cache entries under "Contacts and recent" search headder
#Close Jabber, rename cache, start Jabber
$jabberProcN = 'CiscoJabber'
#$jabberExePath="${env:ProgramFiles(x86)}\Cisco Systems\Cisco Jabber\CiscoJabber.exe"
$jabberContactCachePath = "$env:LOCALAPPDATA\Cisco\Unified Communications\Jabber\CSF\Contacts\UDS*.*"
$time = Get-Date -Format o | foreach {$_ -replace ":", "."}
$jabberContactCacheObj = Get-Item -path $jabberContactCachePath
$jabberProcObj = Get-Process -Name $jabberProcN
@jbilinski
jbilinski / creating-a-series-of-dns-records-1.ps1
Last active July 13, 2016 19:04
bl-creating-a-series-of-dns-records
#requires -Version 4 -Modules DnsServer
$hostnameprefix = 'ava-ks-'
$ipnetstring = '10.111.160.'
$zonename = 'avamar.contoso.com'
$targetdnsserver = 'USKSDC2.Contoso.com'
(1..20).ForEach({Add-DnsServerResourceRecord -A -IPv4Address "$($ipnetstring)$(($_+19)*2)" -Name "$($hostnameprefix)$($_)" -ZoneName $zonename -CreatePtr -ComputerName $targetdnsserver})