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
View Get-AzVnetPeeringAsCSV.ps1
<#
.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++
View README.md

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
View Template SSL Cert Check External.xml
<?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.
View mailRequestCSV
// 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@email.com; email@email.com"
var bcc = "email@email.com"
var sender = "email@email.com"
var ss = SpreadsheetApp.getActiveSpreadsheet();
View Unique X500 Object ID
#---
# 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 October 18, 2022 12:25
Re-index the WSUS Database
View README.md

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
View upgrade-aws-ssm-agent.ps1
# 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%
View Find-File.ps1
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
View Get-CPUConsumptionPerProcess.ps1
#######################################################################################################################
# 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
View Get-TopProcessesCPUConsumers.ps1
#######################################################################################################################
# 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