Skip to content

Instantly share code, notes, and snippets.

View daurrutia's full-sized avatar

David daurrutia

  • D.C.
View GitHub Profile
@daurrutia
daurrutia / import-pem.sh
Created February 15, 2023 03:24
Import certificates previously converted from a bundle in PKCS7 format to PEM format into a Java keystore
#!/bin/bash
# author:
# cmcginty https://stackoverflow.com/a/29997111/7742737
# example:
# ./import-pem.sh TrustedCAs.PEM changeit truststore.jks
PEM_FILE=$1
PASSWORD=$2
KEYSTORE=$3
@daurrutia
daurrutia / Install-Git-LFS-on-Fedora-Remix-for-WSL.md
Last active August 13, 2020 19:54
Install Git LFS on Fedora Remix for WSL
@daurrutia
daurrutia / disable-inprivate.ps1
Created December 7, 2018 21:51
Disable Microsoft Edge's InPrivate Browsing
# https://docs.microsoft.com/en-us/windows/client-management/mdm/policy-csp-browser#browser-allowinprivate
# https://github.com/MicrosoftDocs/windows-itpro-docs/blob/master/browsers/edge/includes/allow-inprivate-browsing-include.md
$path = 'HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\Main'
if (Test-Path $path) {
New-ItemProperty -Path $path -Name AllowInPrivate -PropertyType DWORD -Value 0 -Force
}else{
New-Item -Path $path -Force |
New-ItemProperty -Name AllowInPrivate -PropertyType DWORD -Value 0 -Force
@daurrutia
daurrutia / send-mailmessage.ps1
Created July 6, 2018 12:42
Send an email using PowerShell
##############################################################################
$From = "my_email@gmail.com"
$To = "your_email@yahoo.com.com"
$Cc = "friend_email@outlook.com"
#$Attachment = "C:\temp\Some file.txt"
$Subject = "Email Subject"
$Body = "Insert body text here"
$SMTPServer = "smtp.gmail.com"
$SMTPPort = "587"
@daurrutia
daurrutia / disable-incognitomode.ps1
Created June 25, 2018 15:12
Disables Google Chrome Incognito Mode on Microsoft Windows
# http://dev.chromium.org/administrators/policy-list-3#IncognitoModeAvailability
$path = 'HKLM:\SOFTWARE\Policies\Google\Chrome'
if (Test-Path $path) {
New-ItemProperty -Path $path -Name IncognitoModeAvailability -PropertyType DWORD -Value 1 -Force
}else{
New-Item -Path HKLM:\SOFTWARE\Policies\Google\Chrome\ -Force |
New-ItemProperty -Name IncognitoModeAvailability -PropertyType DWORD -Value 1 -Force
}
@daurrutia
daurrutia / Get-WindowsComputerList.ps1
Created February 6, 2018 21:12
Get and write out list of Windows Server computer names in a domain.
## Get list of all AD Computer Objects
#Get-ADComputer -filter * -Properties dnshostname,operatingsystem | sort Name | select Name,DNSHostName,OperatingSystem
## Export list of all AD Computer Objects inlcuding Ipv4Address property
#Get-ADComputer -filter * -Properties dnshostname,operatingsystem,ipv4address | sort Name | select Name,DNSHostName,Ipv4Address,OperatingSystem | out-file C:\Users\david.urrutia\Desktop\computerIpList.txt
## Get list of all Windows Server computers
#Get-ADComputer -filter {operatingsystem -like "*server*"} -Properties dnshostname,operatingsystem | sort Name | select Name,DNSHostName,OperatingSystem
## Get list of all Windows Server computers
@daurrutia
daurrutia / Compose-MailMsg.ps1
Last active November 7, 2017 16:04
PowerShell: Send Mail Message via Outlook
$outlook = New-Object -comObject Outlook.Application
$mail = $outlook.CreateItem(0)
$mail.To = "user@gmail.com;user2@company.com"
$mail.Cc = "user3@gmail.com;user4@company.com"
$mail.Bcc = "user5@gmail.com;user6@company.com"
$mail.Subject = "MY SUBJECT"
$mail.Body = "Dear Mr. Boss,`n`nHere is the report you requested.`n`nPlease let me know if you have any questions.`n`nSincerely,`nMY NAME`nTITLE`nCONTACT INFO`nCONTACT INFO`nCONTACT INFO"
$mail.Attachments.Add("C:\Users\MYPROFILE\Desktop\FILE.PDF")
$mail.save()
@daurrutia
daurrutia / deploymentSettings.ps1
Last active June 12, 2021 17:54
Windows Server AD Deployment Settings on AWS (DNS, Domain join)
<#
.Synopsis
Joins new Windows server to a Windows domain on AWS
.DESCRIPTION
Sets local DNS entries to DNS server(s) by IP (Set-DnsClientServerAddress)
Enables "Use this connection's DNS suffix in DNS registration" (Set-DnsClient)
Appends domain DNS suffix (WMI)
Adds server to domain in specified OU and renames server (Add-Computer)
.EXAMPLE
Log on to new server
@daurrutia
daurrutia / Capture-Packets.ps1
Created March 10, 2017 02:36
Capture-Packets
# CapturePackets.ps1
# TShark.exe must be installed on the target computer. TShark is part of the Wireshark installation.
# Author: David U. | Operations
$capFile = "Capture-" + (Get-Date -Format yyyyMMddHHmm) + ".pcap"
&"C:\Program Files\Wireshark\tshark.exe" -a filesize:32000 -w "$capfile"