Day: March 29, 2019

PowerShell: Disable NetBios

# Set Credentials $username = "KIMCONNECT\"+(Read-Host -Prompt 'Input the Admin Username: ') $password = Read-Host…

PowerShell: Convert String to Command

# Method 1 $command =@"ping google.com"@$scriptBlock = [Scriptblock]::Create($command)Invoke-Command -ComputerName localhost -ScriptBlock $scriptBlock# Method 2$xVariable="K1"$yVariable="ping"$commandString=$yVariable+" "+$xVariablefunction…

Check Whether an Entity Has Access to a Directory or Its Children

Write-Host "This script just be ran in the context of a File Server Administrators member"…

Check Servers NSLookup of a Listener to Match Active Node IP

$servers="SQL01","SQL02","SQL03","SQL04" $listener="halistener01" $activeNode="10.10.10.5" # Dynamic Credential method 1 $who = whoami if ($who.Substring($who.length-2, 2)="-admin"){$username=$who;} else…

Check a List of Servers to Find Currently Stopped Autorun Services

$username = (Get-ADDomain).name+'\USERNAME' $Password = 'PASSWORD' $pass = ConvertTo-SecureString -AsPlainText $Password -Force $cred = New-Object…

Add a Domain Group to Local Administrators Group

$checkGroup="Administrators" $addMember="KIMCONNECT\Desktop Admins" # Dynamic Credential $who = whoami if ($who.substring($who.length-2, 2) -eq "-admin"){$username=$who;} else…

Add Local Windows User

# Dynamic Credential$who = whoamiif ($who.substring($who.length-2, 2) -eq "-admin"){$username=$who;}else {$username=$who+"-admin";}$password = Read-Host -Prompt "Input the…

SonicWall Port Forwarding

Quick How-To Configuration of SonicWall Many to One NAT Set Up Services Network > Services…

WinRM Management Consideration

Infrastructure needs to be able to leverage scripting automation to perform Vulnerability Remediation, Resource Provisioning,…

Run Windows Commands Remotely

# RPC WMIC /node:SERVER1 process call create 'powershell.exe' # WinRM winrs -r:SERVER1 powershell.exe # Systernals psexec //SERVER1 powershell.exe

HaProxy RDP Forwarding

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp PortNumber = 000001BB frontend fe_rdp_tsc bind 0.0.0.0:443 name rdp_web ssl crt kimconnect.com.pem mode…

PowerShell: Simulate File Open Locking

# Simulate error by creating file in current directory with some contents; then, open file…

Set Permissions of NTFS/SMB Directories Recursively

# Set variables here$proxy="http://proxy:80"$directories="\\FILESERVER01\dept01$","\\FILESERVER01\dept02$"$grantAccess="KIMCONNECT\SysAdmins"$access="Full"# Run as$username = "kimconnect\kim"$password = "PASSWORD"#$username = "kimconnect\"+(Read-Host -Prompt 'Input the…

PowerShell Dealing with Proxy

# Direct Access - no proxy netsh winhttp reset proxy   # Set proxy $proxyString…

PowerShell Script to Copy Members of One Group to Another

#Author: Kim Doan#Please tell me this code suck so that I can improve # Adding…

How to Call Functions or Pass Function as Argument

cls   function listClusters{     # List all Clusters in this Domain     $items=get-cluster -domain (get-addomain)     $global:clusters=$items…

Windows Time Service Configuration

Update 12/27/2019: use this script to set Windows time automatically    It has been a…

Microsoft SQL AlwaysOn Unabridged Notes

Following is a brain dump of the trials and errors in troubleshooting MS-SQL AlwaysOn High…

Apache Multiple Domains Config

vim /ect/httpd/conf/httpd.conf <VirtualHost *:80>      ServerAdmin [email protected]      ServerName kimconnect.com      ServerAlias www.kimconnect.com      DocumentRoot…

Mods to Zencart

Important Mods to Zencart OC GOLD® setup:   Zens Footer copyright info is moded at…