Skip to content

Instantly share code, notes, and snippets.

@emnavarro02
emnavarro02 / Get-AzVnetPeeringAsCSV.ps1
Created November 4, 2022 15:13
Generates a CSV file with all Azure peered VNets
<#
.SYNOPSIS
Retrieves a list of VNet peerings and exports it as CSV.
.DESCRIPTION
Retrieves a list of VNet peerings and exports it as CSV.
Make sure you are logged in the right Azure Tenant/Subscription before running this script.
.PARAMETER ResourceGroupName
The name of the Resource Group
Example: "my-azure-resource-group"
.PARAMETER VNetName
@emnavarro02
emnavarro02 / README.md
Last active July 12, 2022 06:27
Insert timestamp on Notepad++

Insert Timestamp on Notepad++

This is a python-based plugin for inserting custom time/date on Notepad++ documents.

  1. Install the "Python Script" plugin. If you use the Notepad++ Plugin Manager, check where the PythonScript folder has been created (e.g., under %AppData% or %ProgramFiles%) If you prefer, install the PythonScript plugin manually. To do so, you can download the PythonScript plugin from http://npppythonscript.sourceforge.net/download.shtml.
  2. Save the script to the PythonScript\Scripts folder. In my case it was:
    "%ProgramFiles%\Notepad++\plugins\PythonScript\scripts\timestamp.py"
    
@emnavarro02
emnavarro02 / Template SSL Cert Check External.xml
Created March 8, 2022 17:18
Zabbix SSL Certificates monitoring
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2021-04-12T08:47:25Z</date>
<groups>
<group>
<name>MyTemplates</name>
</group>
</groups>
<templates>
@emnavarro02
emnavarro02 / mailRequestCSV
Created June 6, 2021 19:04
Send a GSuite Worksheet via Email as CSV file.
// https://stackoverflow.com/questions/43216543/mailing-google-sheet-as-csv
// https://gist.github.com/mrkrndvs/a2c8ff518b16e9188338cb809e06ccf1
function mailRequestCSV() {
// Send the CSV of the spreadsheet to this email address
var recipients = "[email protected]; [email protected]"
var bcc = "[email protected]"
var sender = "[email protected]"
var ss = SpreadsheetApp.getActiveSpreadsheet();
#---
# http://fkazi.blogspot.com/2013/04/creating-custom-active-directory_27.html
$Prefix="1.2.840.113556.1.8000.2554"
$GUID=[System.Guid]::NewGuid().ToString()
$Parts=@()
$Parts+=[UInt64]::Parse($guid.SubString(0,4),"AllowHexSpecifier")
$Parts+=[UInt64]::Parse($guid.SubString(4,4),"AllowHexSpecifier")
$Parts+=[UInt64]::Parse($guid.SubString(9,4),"AllowHexSpecifier")
$Parts+=[UInt64]::Parse($guid.SubString(14,4),"AllowHexSpecifier")
$Parts+=[UInt64]::Parse($guid.SubString(19,4),"AllowHexSpecifier")
@emnavarro02
emnavarro02 / README.md
Last active May 7, 2024 13:04
Re-index the WSUS Database

The performance of large Windows Server Update Services (WSUS) deployments will degrade over time if the WSUS database is not maintained properly. The WSUSDBMaintenance script is a T-SQL script that can be run by SQL Server administrators to re-index and defragment WSUS databases. It should not be used on WSUS 2.0 databases.This script contributed by the Microsoft WSUS team.

If you are using Windows Internal Database, you will need to use the sqlcmd utility, which can be downloaded from docs.microsoft.com page for SQLCMD. This page will also contain additional information about the sqlcmd utility.

To use this script with Windows Internal Database, you should run the following command:

sqlcmd -S np:\\.\pipe\MICROSOFT##WID\tsql\query -i <script-location>\WSUSDBMaintenance.sql
@emnavarro02
emnavarro02 / upgrade-aws-ssm-agent.ps1
Created April 22, 2020 10:07
Upgrade AWS SSM Agent
# https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-install-win.html
# Requires Administrator Privileges
Invoke-WebRequest `
https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/windows_amd64/AmazonSSMAgentSetup.exe `
-OutFile $env:USERPROFILE\Desktop\SSMAgent_latest.exe
Start-Process `
-FilePath $env:USERPROFILE\Desktop\SSMAgent_latest.exe `
-ArgumentList "/S"
@emnavarro02
emnavarro02 / Find-File.ps1
Created February 14, 2020 15:56
Search for a file stored in any directory defined in %PATH%
Param(
[Parameter(Mandatory=$true)]
[string] $FileName
)
$x= "Path"
$path = (Get-Item env:$x).Value
$path = $path.Split(";")
@emnavarro02
emnavarro02 / Get-CPUConsumptionPerProcess.ps1
Created February 4, 2020 17:25
Get top process CPU consumers
#######################################################################################################################
# Get Top process CPU Consumers
# Author: Emerson Navarro
# Version: 0.1
#######################################################################################################################
# CHANGE LOG:
# - 04/02/2019:
# - Initial PID Collumn
#######################################################################################################################
@emnavarro02
emnavarro02 / Get-TopProcessesCPUConsumers.ps1
Last active February 4, 2020 17:08
Get top processes CPU consumers
#######################################################################################################################
# Get Top process CPU Consumers
# Author: Emerson Navarro
# Version: 0.1
#######################################################################################################################
# CHANGE LOG:
# - 29/01/2020:
# - Initial
# - 31/01/2019:
# - Changing CPU information from Win32_Process to \Process(*)\%Processor Time