Skip to content

Instantly share code, notes, and snippets.

View SvenAelterman's full-sized avatar

Sven Aelterman SvenAelterman

View GitHub Profile
@SvenAelterman
SvenAelterman / Response.json
Last active May 6, 2018 22:18
VS2017 Response.json for silent install
{
"installChannelUri": ".\\ChannelManifest.json",
"channelUri": "https://aka.ms/vs/15/release/channel",
"installCatalogUri": ".\\Catalog.json",
"channelId": "VisualStudio.15.Release",
"productId": "Microsoft.VisualStudio.Product.Enterprise",
"includeRecommended": true,
"includeOptional": true,
"productKey": "AAAAABBBBBCCCCCDDDDDEEEEE",
@SvenAelterman
SvenAelterman / FirewallRules.ps1
Last active July 2, 2017 20:24
Azure SQL DB PowerShell script for managing firewall rules
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionName 'Your Subscription Name'
$RgName = 'Your Resource Group Name'
$SrvName = 'Your SQL Server Name'
$staticIps = "1.2.3.4", "1.2.3.5"
$ruleNames = "Rule 1", "Rule 2"
$i = 0
@SvenAelterman
SvenAelterman / Configure-Sql2017RS.ps1
Last active April 29, 2024 14:31
PowerShell script to configure SQL Server 2017 Reporting Services
<#
#>
function Get-ConfigSet()
{
return Get-WmiObject –namespace "root\Microsoft\SqlServer\ReportServer\RS_SSRS\v14\Admin" `
-class MSReportServer_ConfigurationSetting -ComputerName localhost
}
# Allow importing of sqlps module
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force

Keybase proof

I hereby claim:

  • I am svenaelterman on github.
  • I am svenaelterman (https://keybase.io/svenaelterman) on keybase.
  • I have a public key ASBZCmBChaaiWq4ThPJNCgWm7WQN4D3dTXM0fLujQ1z59go

To claim this, I am signing this object:

# A valid password requires a length of 12 and at least one upper/lower/digit
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*"
# Generate a random string of 12 characters to make the names unique and to use as a password
while ! echo $random12 | grep -P "(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*"
do
random12=$(head /dev/urandom | tr -dc a-zA-Z0-9 | fold -w 12 | head -n 1)
done
region="eastus"
group="rg-disk-test-$random12"
<#
Written with version 2.8.0 of the Azure PowerShell Module
available from here https://github.com/Azure/azure-powershell/releases/tag/v2.8.0-October2019
or run: Install-Module -Name Az -RequiredVersion 2.6.0 -AllowClobber
Migration instructions Azure.RM to Az - https://azure.microsoft.com/en-au/blog/how-to-migrate-from-azurerm-to-az-in-azure-powershell/
#>
# from https://poshtools.com/2018/04/10/cross-platform-out-gridview-using-universal-dashboard/
function Out-GridView
{
@SvenAelterman
SvenAelterman / Set-ClusterProbePort
Created June 30, 2021 22:26
Sets the cluster probe port for Windows Server Failover Cluster (WSFC) in Azure using a load balancer (traditional VNN, not needed for DNN). This is an enhancement to the script at https://docs.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/availability-group-listener-powershell-configure#configure-the-listener
Import-Module FailoverClusters
[int]$ClusterProbePort = 58888 # The probe port from the WSFCEndPointprobe in the Azure portal. This port must be different from the probe port for the availability group listener probe port.
# Retrieve info from the cluster
$ClusterNetworkName = (Get-ClusterNetwork).Name
$IPResource = (Get-ClusterResource | Where {($_.OwnerGroup -eq "Cluster Group" -And $_.ResourceType -eq "IP Address")})
$IPResourceName = $IPResource.Name
$ClusterCoreIP = ($IPResource | Get-ClusterParameter | Where { $_.Name -eq "Address" }).Value
@SvenAelterman
SvenAelterman / CEF_generator.py
Created September 16, 2021 02:12
CEF generator in Python
#!/usr/bin/python3
# Simple Python script designed to write to the local Syslog file in CEF format on an Azure Ubuntu 18.04 VM.
# Frank Cardinale, April 2020
# Sven Aelterman, September 2021
# Importing the libraries used in the script
import random
import syslog
import time
@SvenAelterman
SvenAelterman / Get-WindowsSearchIndexResults.ps1
Last active October 31, 2021 20:27
PowerShell to query local Windows Search index (e.g., for Visio shapes)
$contents = "Virtual"
$sql = "SELECT System.ItemName, System.ItemUrl FROM SYSTEMINDEX WHERE Contains(*,'$($contents)') AND System.ItemType='.VSSX'"
$Provider = "Provider=Search.CollatorDSO;Extended Properties=’Application=Windows’;"
$adapter = new-object system.data.oledb.oleDBDataadapter -argument $sql, $Provider
$ds = new-object system.data.dataset
if ($adapter.Fill($ds)) { $ds.Tables[0] }
@SvenAelterman
SvenAelterman / New-ApiPermissionForManagedIdentity.ps1
Last active October 28, 2021 14:31
Adding (Microsoft Graph) API permissions to a Managed Identity (such as for Logic Apps).
# From https://aztoso.com/security/microsoft-graph-permissions-managed-identity/
# Your tenant id (in Azure Portal, under Azure Active Directory -> Overview )
$TenantID = ""
# Microsoft Graph App ID (DON'T CHANGE)
$GraphAppId = "00000003-0000-0000-c000-000000000000"
# Name of the system managed identity (same as the Logic App name)
$DisplayNameOfMSI = "demoLogicApp"
# Check the Microsoft Graph documentation for the permission you need for the operation
$PermissionName = "Domain.Read.All"