Category: Codes

PowerShell RandomPassword Function

function randomPassword{    # return a reasonably randomized password that starts with "KimConnect:" plus 25…

ipToHostname

Get-Content C:\Users\kimconnect\Desktop\ipList.txt | ForEach-Object {([system.net.dns]::GetHostByAddress($_)).hostname}

Windows Cleanup

#Clean Up the WinSxS FolderDism.exe /online /Cleanup-Image /StartComponentCleanup#Clean Up C:\Temp Folderdel c:\temp -Recurse -Force#Cleanup Event…

Harden Windows Server 2016

# IE Enhanced Security:$AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"$UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"    Set-ItemProperty -Path…

Resolve Error: (59) An unexpected network error occurred

Prerequisites:   Ensure the the target machine has PowerShell Remoting Enabled (as it's Disabled by…

Import A WMWare.PowerCLI from Behind the Proxy

VMWare PowerCLI is a must for Administrators. Here's a quick script to install it. If…

Window Update Via PowerShell

Set Proxy netsh winhttp set proxy proxy-server="hqproxy:80" bypass-list="*.kimconnect.com;192.168.*.*;"[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU","UseWUServer",0,[Microsoft.Win32.RegistryValueKind]::DWord)restart-service wuauserv Enable Windows Update Repository: Set-ExecutionPolicy RemoteSigned…

Microsoft SQL AlwaysOn High Availability Cluster Management Tool

There are some bugs in the script. I'm too lazy to go back a fix…

Simple Active Directory & DNS Synchronization Script

@echo offGOTO push_or_pull:push_or_pullset /p action="Type in Push, Pull, or Quit. Press Enter for default action…

How to Add a Replica into an Existing Availability Group using PowerShell

Overview:0. Add secondary replica to the cluster by running some commands on the availability group…

CentOS System Setup

Notes from 2018...   # Upgrade system and clean disk yum upgrade yum clean all…

HAProxy Example for SSH & OpenVNP forwarding

# Source: https://limbenjamin.com/articles/running-https-ssh-vpn-on-port-443.html   global tune.ssl.default-dh-param 2048   defaults timeout connect 5000 timeout client 50000 timeout…

HAProxy on CentOS 7

# Install HAProxy 1.8 using SCL repo yum install centos-release-scl yum install rh-haproxy18-haproxy rh-haproxy18-haproxy-syspaths  …

HAProxy with Multiple SSL Certs

Method 1: --------- defaults   log 127.0.0.1 local0   option tcplog   frontend ft_test   mode http   bind…

getDCTimeSources

$domain=(Get-ADDomain).DNSRoot $dcs=(Get-ADDomainController -Filter * -Server $domain).Hostname $dcTimeSources=@() foreach ($dc in $dcs) { #$timeSource=w32tm /query /computer:$dc…

Set File Permissions Recursively – Running on File Server

What problems does this solve? This error: "Failed to enumerate objects in the container. Access…

SQL Failover (Simple Method)

$servers="SQL01","SQL02","SQL03"; # Dynamic Credential method 1 $who = whoami if ($who.substring($who.length-2, 2) -eq "-admin"){$username=$who;} else…

Remediate IE Vulnerabilities

<# PowerShell Script to Secure Internet Explorer & Memory Operations reg add "HKLM\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ENABLE_PRINT_INFO_DISCLOSURE_FIX" /v…

PowerShell: Passing Local Functions to Remote WinRM Sessions

# Dynamic Credential Method 1 $who = whoami if ($who.substring($who.length-2, 2) -eq "-a"){$username=$who;} else {$username=$who+"-admin";}…

List Folder Sizes

# Powershell Script to list folders sizes Install-Module PSFolderSize $folders = "\\FILESERVER01\SHARE01","C:\Windows\Users\kimconnect" foreach ($folder in…