Skip to content

Instantly share code, notes, and snippets.

Avatar

Shannon Brooks realslacker

View GitHub Profile
@realslacker
realslacker / Get-UniFiBackup.PS1
Last active Aug 28, 2021
Powershell Script to download backup from a Ubiquiti UniFi Controller or Cloud Key
View Get-UniFiBackup.PS1
<#
.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 Aug 28, 2021
Add or remove Nextcloud/OwnCloud icon to Explorer file navigation (like Dropbox/OneDrive/G-Drive) for a shortcut to your Nextcloud folder.
View Nextcloud Icon Add.reg
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 Mar 25, 2020
Ubuntu Auto-Update Script
View autoupdate.sh
#!/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 Oct 26, 2018
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.
View signthis.cmd
@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 Jan 30, 2018
Removes Provisioned Appx Packages from a WIM file to allow Windows to be deployed without the provisioned apps pre-installed.
View Remove-AppxProvisionedPackagesFromWim.ps1
<#
.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 Jan 30, 2018
Push a LayoutModification.xml file into a WIM prior to installation.
View Update-StartLayoutInWim.ps1
<#
.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 Mar 11, 2021
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.
View RegToXml.psm1
<#
.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.
View NetTests.psm1
<#
.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 Mar 29, 2018
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.
View wpkg.cmd
@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 Apr 18, 2018
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.
View Remove-McAfee.ps1
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