Skip to content

Instantly share code, notes, and snippets.

Avatar

Shannon Graybrook realslacker

View GitHub Profile
@realslacker
realslacker / Convert-VMwareGuestUUIDtoMDTUUID.ps1
Created March 27, 2023 20:33
Convert VMware Guest UUID to MDT UUID
View Convert-VMwareGuestUUIDtoMDTUUID.ps1
param($VM)
# VMware Guest UUIDs are big edian, MDT expects middle edian
# here we reverse the byte order of the first three sections of the guid and then cast back to a guid
[guid][byte[]]([guid]$VM.ExtensionData.Config.Uuid).ToByteArray()[3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15,16,17]
@realslacker
realslacker / Reset-ADUserAdminCount.ps1
Created May 19, 2022 17:03
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 / Regular Expressions.ps1
Created December 10, 2021 20:37
Useful Regular Expressions
View Regular Expressions.ps1
# Relative OU Path
$RelativeOU = '^(?:(?:CN|OU)=(?:(?<=\\),|[^,])+(?:,(?=(?:CN|OU)=(?:(?<=\\),|[^,])+)|$))+$'
# Full OU
$OU = '^(?:(?:CN|OU)=(?:(?<=\\),|[^,])+,)+(?:DC=(?:(?<=\\),|[^,])+(?:,(?=DC=(?:(?<=\\),|[^,])+)|$))+$'
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' ),
View Update-WallpaperFromWindowsSpotlight.ps1
<#
.SYNOPSIS
Update your desktop wallpaper from Windows Spotlight using PowerShell
.NOTES
Author: Shannon Graybrook
Github: github.com/realslacker
#>
#requires -version 5.1
@realslacker
realslacker / Add-WindowsCapability.ps1
Last active October 30, 2019 14:50
Module with Add-WindowsCapability proxy function to which allows bypassing WSUS for Add-WindowsCapability.
View Add-WindowsCapability.ps1
# iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/realslacker/fc8784324eea99e7aea48e54d8847704/raw'))
#Requires -Modules DISM
function Add-WindowsCapability {
[CmdletBinding()]
param(
[Parameter(ParameterSetName='Online', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='Offline', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNullOrEmpty()]
View Convert-NetIPAddressToStatic.ps1
#Requires -Version 4.0
<#
.SYNOPSIS
Convert DHCP address to static on a remote machine.
.DESCRIPTION
Convert a DHCP lease address to a static IP address assignment on a remote machine.
Uses PSRemoting to detect IP settings and a scheduled task to make the IP configuration
change.
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 / Enable-ADReplicationChangeNotification.ps1
Last active October 4, 2019 14:28
This function performs the configuration change described by the article "Active Directory Replication: Change Notification & You" by Chad Duffey (see: https://blogs.msdn.microsoft.com/canberrapfe/2012/03/25/active-directory-replication-change-notification-you/)
View Enable-ADReplicationChangeNotification.ps1
#requires -Modules ActiveDirectory
<#
.SYNOPSIS
Enables Change Notification on IP AD Replication Site Links
.PARAMETER SiteLink
The DistinguishedName of the SiteLink to modify.
.PARAMETER Domain
View ImmediateScheduledTask.psm1
<#
.SYNOPSIS
Creates an Immediate Scheduled Task
.PARAMETER ComputerName
The computer(s) for the task to be executed.
.PARAMETER TaskName
The name of the task.