Skip to content

Instantly share code, notes, and snippets.

View realslacker's full-sized avatar

Shannon Graybrook realslacker

View GitHub Profile
@realslacker
realslacker / Get-UniFiBackup.PS1
Last active May 30, 2024 21:43
Powershell Script to download backup from a Ubiquiti UniFi Controller or Cloud Key
<#
.NOTES
Author: Shannon Brooks
Date: Dec 1st, 2016
Licence: Creative Commons Attribution-ShareAlike 4.0 International License
License URL: http://creativecommons.org/licenses/by-sa/4.0/
.SYNOPSIS
@realslacker
realslacker / Nextcloud Icon Add.reg
Last active July 23, 2024 18:11
Add or remove Nextcloud/OwnCloud icon to Explorer file navigation (like Dropbox/OneDrive/G-Drive) for a shortcut to your Nextcloud folder.
Windows Registry Editor Version 5.00
; NOTE, this file uses a GUID generated here
; https://www.guidgenerator.com/online-guid-generator.aspx
; IF you are going to have multiple Nextcloud folders in your tree you
; will need to make a new GUID for each folder and find/replace the
; value "38d6662b-09f4-4e73-bf61-b0e512ec41e1" with your unique GUID
[HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\\{38d6662b-09f4-4e73-bf61-b0e512ec41e1}]
; Name of the folder, also see last line below
@realslacker
realslacker / autoupdate.sh
Last active March 25, 2020 07:02
Ubuntu Auto-Update Script
#!/bin/bash
# to install directly from the Gist
# curl https://gist.githubusercontent.com/realslacker/6dce254e16003fbec5451689c9ba1e49/raw/ | bash -s -- -i
# test getopt
getopt --test > /dev/null
if [[ $? -ne 4 ]]; then
echo "Error: `getopt --test` failed in this environment, please update to a newer 'getopt' package"
exit 1
@realslacker
realslacker / signthis.cmd
Last active October 26, 2018 14:29
Detects and uses the 'signtool.exe' from the Windows SDK/ADK to sign a file with your code signing certificate when you drag and drop file(s) onto the batch file.
@ECHO OFF
REM Note that I have issues getting the Windows 10 SDK version of signtool to run,
REM so I usually install the Windows 7.1 SDK version of signtool.
REM
REM Download: https://www.microsoft.com/en-us/download/details.aspx?id=8279
REM Install Feature: Windows Native Code Development\Tools
REM
REM NOTE: If you have problems installing the Windows 7.1 SDK it may be because
REM you already have the VC++ 2010 runtime libraries installed.
@realslacker
realslacker / Remove-AppxProvisionedPackagesFromWim.ps1
Created January 30, 2018 18:57
Removes Provisioned Appx Packages from a WIM file to allow Windows to be deployed without the provisioned apps pre-installed.
<#
.SYNOPSIS
Removing Built-in apps from Windows 10 / Windows 8.1 / Windows 8
.DESCRIPTION
Removing Built-in apps from Windows 10 / Windows 8.1 / Windows 8
.PARAMETER Path
The path to the WIM image file (typically install.wim)
@realslacker
realslacker / Update-StartLayoutInWim.ps1
Created January 30, 2018 18:58
Push a LayoutModification.xml file into a WIM prior to installation.
<#
.SYNOPSIS
Update the Start Menu layout in a WIM file
.DESCRIPTION
Update the Start Menu layout in a WIM file
.PARAMETER Path
The path to the WIM image file (typically install.wim)
@realslacker
realslacker / RegToXml.psm1
Last active November 9, 2024 22:58
Converts a .REG file into an XML document that is compatible with GPO preferences. The registry file can contain updates or deletions. The resulting XML file can be copy and pasted, or drag and dropped onto the GPO preferences registry window to import the file.
<#
.SYNOPSIS
Converts a .REG file into an XML document that is compatible with GPO
preferences.
.DESCRIPTION
Converts a .REG file into an XML document that is compatible with GPO
preferences. The registry file can contain updates or deletions. The
resulting XML file can be copy and pasted, or drag and dropped onto the
GPO preferences registry window to import the file.
<#
.SYNOPSIS
Helper function to test a TCP port.
.DESCRIPTION
Helper function to test a TCP port.
.PARAMETER Destination
DNS name or IP address of the host to test.
@realslacker
realslacker / wpkg.cmd
Last active March 29, 2018 20:26
Place in System32 directory to allow you to run WPKG from the command line. Relies on Elevate (see http://code.kliu.org/misc/elevate/) to launch as administrator.
@ECHO OFF
SET ALLARGS=
SET CLOSEMODE=
REM Verify that elevate is installed
IF EXIST C:\Windows\System32\elevate.exe GOTO :SKIPERROR
ECHO This script must be run with Administrator rights!
PAUSE
EXIT 1
:SKIPERROR
@realslacker
realslacker / Remove-McAfee.ps1
Created April 18, 2018 20:08
Runs McAfee MFERemoval100.exe with a valid date for the uninstaller. Tested with Q1 2018 uninstaller. In my use case I used PS1_to_EXE to package the uninstaller and script together and run silently.
if ( -not (Test-Path "$env:ProgramW6432\McAfee") -and -not(Test-Path "${env:ProgramFiles(x86)}\McAfee") ) { exit 0 }
$OriginalDate = Get-Date
# Set the date back to allow MFERemoval to run
Set-Date -Date '01/01/2018'
# Run removal tool
Start-Process -FilePath "$PWD\MFERemoval100.exe" -ArgumentList '/noreboot','/q','/all','/force' -Wait