Skip to content

Instantly share code, notes, and snippets.

View blakedrumm's full-sized avatar
🏠
Working from home

Blake Drumm blakedrumm

🏠
Working from home
View GitHub Profile
@blakedrumm
blakedrumm / SCOM_2019_Messages.sql
Created March 14, 2023 16:11
Messages Table for SCOM 2019
EXEC sp_addmessage @msgnum = 777970001, @msgtext = N'Login specified as Management Group Writer Login is already specified as writer login for another pending Management Group connect operation. Choose different login or confirm/reject previous connect operation', @severity = 16, @lang = 'us_english', @with_log = False, @replace = 'REPLACE'
EXEC sp_addmessage @msgnum = 777970002, @msgtext = N'Management Group is already connected to this Data Warehouse', @severity = 16, @lang = 'us_english', @with_log = False, @replace = 'REPLACE'
EXEC sp_addmessage @msgnum = 777970004, @msgtext = N'Operation may be performed only by Data Warehouse owning Management Group. This management group is not owner and may not perform requested operation', @severity = 16, @lang = 'us_english', @with_log = False, @replace = 'REPLACE'
EXEC sp_addmessage @msgnum = 777970005, @msgtext = N'Management group with id ''''%s'''' is not a member of this Data Warehouse or you do not have permissions to perform actions for that management group'
@blakedrumm
blakedrumm / Invoke-EnforceSCOMTLS1.2.ps1
Last active March 22, 2024 01:17
Enforce TLS 1.2 in SCOM
<#
.SYNOPSIS
This script allows you to enforce TLS 1.2 on System Center Operation Manager environments.
.DESCRIPTION
Use this script when you need to want to automate the steps listed here:
https://learn.microsoft.com/system-center/scom/plan-security-tls12-config
.PARAMETER AssumeYes
The script will not ask any questions. Good for unattended runs.
@blakedrumm
blakedrumm / SCOM_2022_Messages.sql
Created May 23, 2023 18:37
Messages Table for SCOM 2022
EXEC sp_addmessage @msgnum = 777970001, @msgtext = N'指定成管理群組寫入器登入的登入已指定成另一項擱置管理群組連線作業的寫入器登入。請選擇其他登入,或確認/拒絕先前的連線作業', @severity = 16, @lang = 'us_english', @with_log = False, @replace = 'REPLACE'
EXEC sp_addmessage @msgnum = 777970002, @msgtext = N'管理群組已連線至此資料倉儲', @severity = 16, @lang = 'us_english', @with_log = False, @replace = 'REPLACE'
EXEC sp_addmessage @msgnum = 777970004, @msgtext = N'只能由擁有管理群組的資料倉儲執行作業。此管理群組不是擁有者,無法執行要求的作業', @severity = 16, @lang = 'us_english', @with_log = False, @replace = 'REPLACE'
EXEC sp_addmessage @msgnum = 777970005, @msgtext = N'識別碼為 ''''%s'''' 的管理群組不是此資料倉儲的成員,或者您沒有對該管理群組執行動作的權限', @severity = 16, @lang = 'us_english', @with_log = False, @replace = 'REPLACE'
EXEC sp_addmessage @msgnum = 777970006, @msgtext = N'無法從資料倉儲刪除其擁有的管理群組,因為還有其他成員管理群組存在。請先刪除成員管理群組。', @severity = 16, @lang = 'us_english', @with_log = False, @replace = 'REPLACE'
EXEC sp_addmessage @msgnum = 777970007, @msgtext = N'識別碼為 ''''%s'''' 的管理群組不是此資料倉儲的成員管理群組', @severity = 16, @lang = 'us_english', @with_log = False,
@blakedrumm
blakedrumm / Update-SCOMCertificate.ps1
Last active June 14, 2023 15:13
This script will allow you to update the certificate used in SCOM, using PowerShell.
param
(
[string]$FriendlyName,
[string]$SubjectName,
[string]$SerialNumber,
[string]$DateIssued,
[string]$ExpirationDate,
[switch]$ShowAllCertificates,
[switch]$UpdateRegistry
)
select *
from BaseManagedEntity BME
LEFT JOIN TypedManagedEntity TME
ON BME.BaseManagedEntityId = TME.TypedManagedEntityId
where TME.BaseManagedEntityId IS NULL
@blakedrumm
blakedrumm / Gather_Plex_User_Count.ps1
Last active August 7, 2023 18:53
Gather a list of Usernames and Emails for all users.
#Author: Blake Drumm
#Date: August 7th, 2023
#-----------------------------------------------
# REQUIRED
#-----------------------------------------------
# Prefil the XPlexToken before running the script
$XPlexToken = 'GZZ4qopzCuczOKW9qIPX'
#-----------------------------------------------
@blakedrumm
blakedrumm / AzureVMRolePolicySetup.ps1
Last active March 31, 2024 05:01
VM Management Role and Update Compliance Policy Setup Script
# ============================================================================
# Name: VM Management Role and Update Compliance Policy Setup Script
# ------------------------------------------------------------------
# Description: This PowerShell script automates the creation or updating of a custom Azure role and policy definition
# for managing virtual machine (VM) security and compliance. It ensures VMs within specified subscriptions are managed
# with enhanced permissions, including disk encryption set reading, and comply with system update policies. If the
# targeted custom role does not exist, it creates one by extending the "Virtual Machine Contributor" role. It then
# duplicates a built-in Azure policy for system update assessments, integrating the custom role to enforce update
# compliance. Designed for Azure administrators, this script streamlines VM management, security, and compliance
# within Azure environments.
@blakedrumm
blakedrumm / Check-SSLAzureEndpoints.ps1
Created February 15, 2024 23:11
Check the Endpoints required for Azure Arc for TLS 1.2 connectivity
function CheckSSL($fqdn, $port=443, $tls="tls12")
{
Try {$tcpsocket = New-Object Net.Sockets.TcpClient($fqdn, $port)} Catch {Write-Warning "$($_.Exception.Message) / $fqdn";break}
$certCollection = New-Object System.Security.Cryptography.X509Certificates.X509CertificateCollection
$sslProtocols = [System.Security.Authentication.SslProtocols]::$tls
""; "-- Target: $fqdn / " + $tcpsocket.Client.RemoteEndPoint.Address.IPAddressToString
$sslStream = New-Object System.Net.Security.SslStream($tcpsocket.GetStream(), $false)
$sslStream.AuthenticateAsClient($fqdn, $certCollection, $sslProtocols, $true) ## A Boolean value that specifies whether the certificate revocation list is checked during authentication
$certinfo = New-Object security.cryptography.x509certificates.x509certificate2($sslStream.RemoteCertificate)
$sslStream | select-object | FT sslProtocol,CipherAlgorithm, HashAlgorithm,KeyExchangeAlgorithm,IsAuthenticated,IsEncrypted,IsSigned, CheckCertRevocationStatus
@blakedrumm
blakedrumm / Retrieve-MicrosoftDownloadInfo.ps1
Last active February 28, 2024 00:37
Automate Microsoft download details extraction effortlessly with this PowerShell script. Retrieve title, version, release date, and URL information using provided IDs.
<#
Author: Blake Drumm (blakedrumm@microsoft.com)
Date Created: February 27th, 2024
Description:
This PowerShell script automates the extraction of key details like title, version, release date, and URL for Microsoft downloads based on provided IDs.
By utilizing web scraping methods, it facilitates the seamless retrieval and organization of essential information from Microsoft's download pages.
#>
$FinalOutput = @()
$x = 0
@blakedrumm
blakedrumm / Gather_AzureArc_Version.kql
Created February 28, 2024 00:26
An Azure Resource Graph query to efficiently map and manage microsoft.hybridcompute/machines with detailed insights on OS versions, agent details, and provisioning statuses for improved infrastructure oversight.
/*
Author: Blake Drumm (blakedrumm@microsoft.com)
Date Created: February 27th, 2024
Description:
Azure Resource Graph query for enhanced inventory management of microsoft.hybridcompute/machines,
detailing essential attributes such as display names, operating system versions with friendly names for Windows 11,
Windows 10, and various Windows Server releases, agent version, automatic upgrade capability, provisioning state,
and ESU license status. By using regular expressions for accurate OS version categorization, it offers administrators
and support teams a powerful tool for comprehensive oversight and management of hybrid computing environments,
facilitating effective upgrade planning, compliance monitoring, and support tasks.