Skip to content

Instantly share code, notes, and snippets.

@drtomasso
drtomasso / convert-rdb-to-csv.py
Created July 4, 2023 07:51
Convert RDB (Microsoft Remote Desktop) to CSV for mRemoteNG
import csv
import json
import re
import sys
import uuid
def json_to_csv(json_file, csv_file):
with open(json_file) as f:
data = json.load(f)
@drtomasso
drtomasso / Get-TeamsAndChannels.ps1
Created March 18, 2023 12:29
Retrieve and Update Microsoft Teams and Channels Information: A set of two PowerShell scripts to retrieve Microsoft Teams and channels information, including SharePoint site URLs, visibility, sensitivity labels, and owners' user principal names. The first script (PowerShell 7) fetches the initial data, while the second script (PowerShell 5) upda…
<#
.SYNOPSIS
This script retrieves information about Microsoft Teams and their channels, including
SharePoint site URLs, visibility, sensitivity labels, and owners' user principal names.
.DESCRIPTION
The script authenticates using MSAL.PS and retrieves data from the Microsoft Graph API.
It exports the data to a CSV file for further processing. Sensitivity labels are not
retrieved in this script due to limitations in PowerShell 7 and MSAL.PS.
@drtomasso
drtomasso / ExtendM365GroupExpiration.ps1
Last active March 17, 2023 11:35
PowerShell script to extend the expiration date of Microsoft 365 groups using Azure Automation and Managed Identity
<#
.SYNOPSIS
This PowerShell script extends the expiration date of Microsoft 365 groups and sends the results to a Microsoft Teams channel.
.DESCRIPTION
To use this script with Azure Automation, follow these steps:
1. Create an Azure Automation account in the Azure portal.
2. Import the required modules (Az.Accounts, MSGraphSDK) into the Automation account.
3. Create a new PowerShell Runbook and paste the entire script.
@drtomasso
drtomasso / ad_users_group_matrix.ps1
Created November 13, 2017 09:48
Export AD users in OU as Y-axis, Groups as X-axis, marks field where user is member of group
#####
### ./ad_user_group_matrix.ps1
### Export users in OU as Y-axis, Groups as X-axis, marks field where user is member of group
#####
# Import Modules
import-module activedirectory
# Empty Array
$Array = @()
@drtomasso
drtomasso / check_zfs_snap.sh
Created January 20, 2016 13:47
Check ZFS snapshot creation date. For Nagios NRPE
#!/bin/bash
FSNAME=$1
WARNAGE=$2
CRITAGE=$3
NOW=$(date +%s)
ZFS="sudo /sbin/zfs"
AWK="/usr/bin/awk"
@drtomasso
drtomasso / add_counters.patch
Last active November 27, 2018 13:29
Observium: Add separate pagecounters for color and black
From ffc9255934b84a1094d936cd0c38365d6cf306d3 Mon Sep 17 00:00:00 2001
From: drtomasso
Date: Tue, 30 Jun 2015 11:08:13 +0200
Subject: [PATCH] add separate counters for color and black/white prints (testet on Ricoh)
---
.../includes/graphs/device/pagecount_black.inc.php | 17 ++++++++++
.../includes/graphs/device/pagecount_color.inc.php | 17 ++++++++++
html/pages/device/printing.inc.php | 20 ++++++++++++
includes/discovery/toner.inc.php | 24 +++++++++++++++
@drtomasso
drtomasso / gist:e291633b5147d0be35e7
Last active January 6, 2024 20:21 — forked from GC-Mark/gist:4bdef466a2cac58087a6
MYSQL: Generate Calendar Table - With Holidays
/* GENERATE CALENDAR TABLE FOR MYSQL WITH WEEKEND AND HOLIDAYS
* Added easter-function from http://planet.mysql.com/entry/?id=30328
* Added Norwegian holidays, holidays are marked with a '1'
* Create function first, to be used in procedure
* Updated (2019-03-19): Changed Easter calculation, fixed some errors
*/
DELIMITER //
CREATE FUNCTION EasterSunday(inYear YEAR) RETURNS DATE DETERMINISTIC
BEGIN
DECLARE a, b, c, d, e, f, g, h, i, k, l, m, n, p INT;