Skip to content

Instantly share code, notes, and snippets.

Avatar

Shannon Graybrook realslacker

View GitHub Profile
@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
View HOWTO Nextcloud SAML Login with AzureAD.md

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 / Reset-ADUserAdminCount.ps1
Created May 19, 2022
Reset a user account adminCount and restore the default ACL.
View Reset-ADUserAdminCount.ps1
#requires -Modules ActiveDirectory
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact='High'
)]
param(
[Parameter(
Mandatory=$true,
@realslacker
realslacker / RegToXml.psm1
Last active Mar 23, 2022
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.
@realslacker
realslacker / Enable-VSSShadowCopies.ps1
Created Jun 6, 2018
Enable VSS Shadow Copies on remote computers.
View Enable-VSSShadowCopies.ps1
<#
.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 / Nextcloud Icon Add.reg
Last active Feb 20, 2022
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 / Regular Expressions.ps1
Created Dec 10, 2021
Useful Regular Expressions
View Regular Expressions.ps1
# Relative OU Path
$RelativeOU = '^(?:(?:CN|OU)=(?:(?<=\\),|[^,])+(?:,(?=(?:CN|OU)=(?:(?<=\\),|[^,])+)|$))+$'
# Full OU
$OU = '^(?:(?:CN|OU)=(?:(?<=\\),|[^,])+,)+(?:DC=(?:(?<=\\),|[^,])+(?:,(?=DC=(?:(?<=\\),|[^,])+)|$))+$'
@realslacker
realslacker / clear icon cache.cmd
Created Oct 31, 2018
Clear the icon cache to fix Windows 10 start menu icons
View clear icon cache.cmd
ie4uinit.exe -ClearIconCache
taskkill /IM explorer.exe /F
DEL "%localappdata%\IconCache.db" /A
explorer
@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
View Invoke-ADReplication.ps1
[CmdletBinding()]
param(
[Parameter( Mandatory, Position = 1, ValueFromPipelineByPropertyName, ValueFromPipeline )]
[Alias( 'HostName', 'Server' )]
[string[]]
$ComputerName,
[System.DirectoryServices.ActiveDirectory.SyncFromAllServersOptions]
$SyncOptions = @( 'CrossSite', 'PushChangeOutward', 'SkipInitialCheck' ),