Skip to content

Instantly share code, notes, and snippets.

View bluPhy's full-sized avatar
🏠
Working from home

bluPhy bluPhy

🏠
Working from home
View GitHub Profile
# Enables TLS 1.2 on Windows Server 2008/2012/2016 and Windows 7/8.1/10
# Add and Enable TLS 1.2 for client and server SCHANNEL communications
New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2" -Force
New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -Force
New-Itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "Enabled" -value "0xffffffff" -PropertyType "DWord"
New-Itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "DisabledByDefault" -value 0 -PropertyType "DWord"
New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -Force
New-Itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "Enabled" -value 1 -PropertyType "DWord"
@bluPhy
bluPhy / hosts.ps1
Last active August 31, 2021 11:13 — forked from lantrix/hosts.ps1
Powershell script for adding/removing/viewing entries to the hosts file.
#
# Powershell Functions for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
Function Use-RunAs {
# Check if script is running as Administrator and if not use RunAs
# Use Check Switch to check if admin
param([Switch]$Check)
@bluPhy
bluPhy / ftps_ClientCertAuth_IIS.vbs
Last active September 6, 2018 14:22
This script configures the FTPS Service in IIS to use client certificate authentication
' This is a Robert McMurray's script, all the credit goes to him :)
' https://blogs.msdn.microsoft.com/robert_mcmurray/2012/04/26/configuring-ftp-client-certificate-authentication-in-ftp-7/
'
' Please change the following two variables before running it
Set strSiteName = "FTP"
Set strSserverCertHash = "884301293bad5ab538c0cfddcba7371cedfca647"
Set adminManager = CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
@bluPhy
bluPhy / ChangeDNSServerSettings.ps1
Last active August 31, 2021 11:11
Menu based PowerShell script to change DNS servers for local area connections
#
# Menu based Powershell script to change DNS servers for local area connections.
#
$DNSServer = @{"Home1" = "192.168.2.2";
"Home2" = "192.168.2.10";
"Home3" = "192.168.2.1";
"OpenDNS1" = "208.67.220.220";
"OpenDNS2" = "208.67.222.222";
"Google1" = "8.8.8.8";
@bluPhy
bluPhy / Get-Permissions-NTFS-SMB.ps1
Last active April 1, 2023 17:10
List all share and NTFS permissions in the local machine
$ComputerName = $env:computername
$AllShares = Get-WmiObject -Class win32_share -ComputerName $ComputerName | Select-Object -ExpandProperty Name
Function GetShareSecurity {
Param([string]$path = $(throw"$path required."))
Write-Host "--------------------------------------------------"
$pathparts = $path.split("\")
$ComputerName = $pathparts[2]
$ShareName = $pathparts[3]
@bluPhy
bluPhy / Use-RunAsAdmin(function).ps1
Last active September 10, 2021 18:23
Check if script is running as Administrator or with elevated privilege, if not use RunAs
function Use-RunAs {
# Check if script is running as Administrator or with elevated privilege, if not use RunAs
# Use Check Switch to check if admin
param([Switch]$Check)
# Detecting OS Platform, win32nt for Windows or unix for Linux/Unix
$OSPlatform = (([System.Environment]::OSVersion.Platform).ToString()).ToLower()
if ($OSPlatform -eq "unix") {
Write-Warning "Detected Linux/Unix OS, you don't need this, use sudo"
exit # Quit this session of powershell
#!/usr/bin/env bash
# This script list all AMIs in use in all regions in an account
# Author: [email protected]
# Check if AWS CLI is installed
if ! command -v aws &> /dev/null; then
echo "AWS CLI could not be found"
exit
fi
@bluPhy
bluPhy / AWS-ListAllAMIsInUse.ps1
Last active August 31, 2021 11:09
AWS-ListAllAMIsInUse.ps1
Function Get-AWSModule {
Param([string]$name)
if (-not(Get-Module -Name $name)) {
if (Get-Module -ListAvailable | Where-Object { $_.name -eq $name }) {
Import-Module -Name $name
$true
} #end if module available then import
else { $false } #module not available
} # end if not module
else { $true } #module already loaded
########################################################################################
# This will list all API names and regional enpoints for all AWS regions #
# querying all regions also allow us to get the list of services available per region #
########################################################################################
Function Get-AWSModule {
Param([string]$name)
if (-not(Get-Module -Name $name)) {
if (Get-Module -ListAvailable | Where-Object { $_.name -eq $name }) {
@bluPhy
bluPhy / AWS-Rename-Volumes-to-Match-Instance-Name.ps1
Last active January 24, 2022 14:54
AWS-Rename-Volumes-to-Match-Instance-Name.ps1
$Tab = [char]9
$Tag = New-Object Amazon.EC2.Model.Tag
foreach ($vol in (Get-EC2Volume)) {
$EBSVolId = $($vol.Attachments.VolumeId)
$EC2InstanceId = $($vol.Attachments.InstanceId)
$EC2InstanceName = ((Get-EC2Instance -InstanceId $EC2InstanceId).Instances.Tags | Where-Object { $_.Key -eq "Name" } | Select-Object -ExpandProperty Value)
Write-Host "Volumen Id:" $EBSVolId $Tab "Instance Id:" $EC2InstanceId $tab "Instance Name: " $EC2InstanceName