Skip to content

Instantly share code, notes, and snippets.

View realslacker's full-sized avatar

Shannon Graybrook realslacker

View GitHub Profile
REM This batch file allows you to launch any program as the current user. Placing
REM this file in your System32 directory or adding it to your path will allow you
REM to easily launch applications.
REM Usage: RunAsInvoker.cmd [Application]
REM Example: RunAsInvoker.cmd mmc.exe
REM Example: RunAsInvoker.cmd certmgr.msc
@ECHO OFF
set __COMPAT_LAYER=RUNASINVOKER
start "" %*
@realslacker
realslacker / updaterootca.cmd
Created April 19, 2024 17:05
Update Root CA Certificates on Windows 7 - No PowerShell Dependency
@ECHO OFF
SETLOCAL
FOR /F "tokens=4-5 delims=. " %%i IN ('ver') DO SET VERSION=%%i.%%j
IF "%VERSION%" == "10.0" GOTO :NOUPDATE
IF "%VERSION%" == "6.3" GOTO :NOUPDATE
IF "%VERSION%" == "6.2" GOTO :NOUPDATE
IF "%VERSION%" == "6.1" GOTO :UPDATETry
ENDLOCAL
:NOUPDATE
@realslacker
realslacker / Get-UniFiBackup.PS1
Last active April 9, 2024 10:45
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 / RegToXml.psm1
Last active April 3, 2024 18:54
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.

Enable Nextcloud SAML Login using AzureAD

Create an Enterprise App for Nextcloud

  1. Open the Azure admin portal - https://portal.azure.com
  2. Open Azure Active Directory > Enterprise applications
  3. Click the + New application link at the top
  4. Search for "Azure AD SAML Toolkit" in the gallery
  5. Click on "Azure AD SAML Toolkit"
  6. Enter "Nextcloud" in the Name and click the Add button
@realslacker
realslacker / Enable-VSSShadowCopies.ps1
Created June 6, 2018 15:34
Enable VSS Shadow Copies on remote computers.
<#
.SYNOPSIS
Enable VSS Shadow Copies on remote computers.
.DESCRIPTION
Enable VSS Shadow Copies on remote computers. The default settings will take a snapshot every 1 hour and use up to 5% of the disk.
.PARAMETER ComputerName
The computer(s) to enable VSS on. If piping from Get-ADComputer use 'Get-ADComputer -Filter * | select Name' to handle a bug in Get-ADComputer's piping.
.PARAMETER DriveLetter
Which drive to enable VSS on.
.PARAMETER CacheSize
@realslacker
realslacker / Get-ServerCertificate.ps1
Last active March 4, 2024 18:39
Return the server certificate a server is using on a specified port
<#
.SYNOPSIS
Return the server certificate a server is using on a specified port
.PARAMETER ComputerName
The remote computer to query
.PARAMETER Port
The remote TCP port to query
.PARAMETER SubjectNameIdentifier
The Subject Name Identifier to send to the server, defaults to the computer name
.PARAMETER SkipCertificateCheck
@realslacker
realslacker / authentication.ps1
Created March 1, 2024 09:39
PowerShell Universal Authentication Example Supporting Multiple Domains
Set-PSUAuthenticationMethod -Type "Form" -ScriptBlock {
param(
[PSCredential]$Credential
)
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
# is this a UPN?
if ( $Credential.UserName.IndexOf('@') -gt -1 ) {
@realslacker
realslacker / JavaUninstall.cmd
Created January 31, 2024 21:29
Java Seek and Destroy - Remove Oracle JRE 6-8
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
GOTO :RUN
:UNINSTALL
ECHO -------------------------------------------------------
ECHO UNISTALL 32-Bit java matching "%~1"
ECHO -------------------------------------------------------
@realslacker
realslacker / ScreenConnectReInstall.cmd
Last active January 31, 2024 21:24
ScreenConnect Re-Install BATCH File
@ECHO OFF
REM If you ever need to re-install ScreenConnect on a client machine using
REM automation like Tanium or Automate and PowerShell is BROKEN on the
REM machine... never fear, this script will help you get it done.
REM
REM Note that this script expects to be able to be packaged with wget see:
REM https://eternallybored.org/misc/wget/
REM If wget is not present it will fallback to bitsadmin, however on Windows 7
REM bitsadmin is missing the /dynamic switch and downloads will fail.