Skip to content
blog.KimConnect.com
Menu
Codes
Windows
Linux
Virtualization
Networking
Database
Category:
Codes
blog.KimConnect.com
>>
Codes
,
Windows
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
List Autorun Services
# $cred = get-Credential -credential kdoan-a $Username = 'kimconnect\kim-Admin $Password = 'PASSWORD' $pass = ConvertTo-SecureString…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
Last Logon Dates of List of AD Accounts
import-module activedirectory$output=""Get-Content C:\Users\kimconnect\Desktop\targetAccounts.txt | Foreach-Object -Process{ # cast an array object as string before using…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
Find Empty Directories
$directories="\\FILESERVER01\SHARE01" # Dynamic Credential method 1 $who = whoami if ($who.substring($who.length-2, 2) -eq "-admin"){$username=$who;} else…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
SQL AlwayOn High Availability Default Port
Internal SQL DEV & QA environments may have SQL listening to the default port of…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
PowerShell: Elevating Credential
$jumpbox="127.0.0.1" <# # Static Credentials (unsecured) $username = (Get-ADDomain).name+"\ADMINISTRATOR" $password = "PASSWORD" #> # Dynamic…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
PowerShell: Disable NetBios
# Set Credentials $username = "KIMCONNECT\"+(Read-Host -Prompt 'Input the Admin Username: ') $password = Read-Host…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
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…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
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"…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
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…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
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…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
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…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
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…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
WinRM Management Consideration
Infrastructure needs to be able to leverage scripting automation to perform Vulnerability Remediation, Resource Provisioning,…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
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…
2 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
PowerShell: Simulate File Open Locking
# Simulate error by creating file in current directory with some contents; then, open file…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
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…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
PowerShell Dealing with Proxy
# Direct Access - no proxy netsh winhttp reset proxy # Set proxy $proxyString…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
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…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
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…
0 Comments
Read More
March 29, 2019
March 29, 2019
kimconnect
kimconnect
Apache Multiple Domains Config
vim /ect/httpd/conf/httpd.conf <VirtualHost *:80> ServerAdmin
[email protected]
ServerName kimconnect.com ServerAlias www.kimconnect.com DocumentRoot…
0 Comments
Posts navigation
Previous page
1
…
39
40
41
Next page
Search
Archives
October 2024
September 2024
August 2024
June 2024
May 2024
April 2024
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
Meta
Register
Log in
Tag Cloud