Category: Codes

PowerShell: Exchange Servers Discovery

List Exchange Servers from a non-exchange computer # Obtain a list of all on premise…

PowerShell: Reset Active Directory Server

Step 0: # Ensure that AD management module is available for PS Sessionif (!(get-module -name…

PowerShell: check whether the current user is a member of Domain Admins

# short snippet to check whether the currently login user is a domain admin$CurrentUser =…

Office 365 Active Directory Hybrid Accounts Administration

Intro This scenario assumes that Azure AD Sync has been used to synchronize on premise…

PowerShell: Script to Stop, Start, Disable, and Enable Exchange Server

<#This script contains a set of functions to administer Exchange 2010, 2013, 2016, and 3000.…

PowerShell: Add Office365 Records on DNS Servers

Make Changes to Internal DNS A. Delete Old CNAMES and MX Records Sample commands from…

PowerShell: Raise Domain Forest Functional Level

# Raise Forest Functional Level$forest=Get-ADForest# 2012R2 LevelSet-ADForestMode -Identity $forest -Server $forest.SchemaMaster -ForestMode Windows2012R2Forest -Force# 2016…

PowerShell: Demote Domain Controllers

$computername=$env:computername $localAdminPassword='PASSWORD' function demoteDc($computername=$env:computername,$localAdminPassword){ $erroractionpreference=stop $encryptedPass=convertto-securestring $localAdminPassword -asplaintext -force Import-Module ActiveDirectory $thisComputer=$env:computername $fsmoRoles=Get-ADDomainController -Filter *|Select-Object…

PowerShell: Microsoft Exchange Active Directory Integration

Assuming that Exchange is already set and in production, it's often advisable to record its…

PowerShell: DHCP Server Scope Options Editing

Occasionally, internal DNS server changes as machines are refreshed and/or decommissioned. DHCP servers should also…

PowerShell: Install TightVNC on Windows via CLI

Install VNC Server on the Remote Windows: # Access Remote Server via WinRM$SHERVERNAME = "SHERVER007"$winRMHttp=5985$winRMHttps=5986#…

Repair Windows Server 2016 Error 0x800f081f

Run this function in PowerShell as Administrator: function resetWindowsUpdate{ # Source: https://learn.microsoft.com/en-us/troubleshoot/windows-client/installing-updates-features-roles/additional-resources-for-windows-update write-host 'Resetting Windows…

PowerShell: Set DNS Servers on Localhost

Display the current DNS Server Entries PS C:\Users\KimConnect> Get-DnsClientServerAddressInterfaceAlias Interface Address ServerAddressesIndex Family-------------- --------- -------…

PowerShell: DHCP Server Migration

Nowadays, being lazy is good. Why waste energy with clicking buttons when there are a…

PowerShell: Resolve “CredSSP encryption oracle remediation” Error on Windows 2016

Error message: An authentication error has occurred. The function requested is not supported. Remote computer:…

PowerShell: Enabling and Disabling Network Level Authentication (NLA)

NLA is Microsoft's answer to mitigate some DDoS attacks via remote desktop (RDP). It uses…

Install AWS Command Line Interface on Windoze

Obtain AWS Access Key: Log into AWS > click on your User Name > My…

PowerShell: Use RoboCopy & Volume Shadow Copy to Mirror Terrabytes of Data

version 0.2 <#.DescriptionCurrent Features:1. Check for any errors on the Sources or Destinations and generate…

Reference Entries of Office 365 records for Internal & External DNS

General Office 365 email setup check list: MS requires that each smart-host configuration or send…

PowerShell: Measure File Copying Time

The scripty: $sourcesAndDestinations=@("C:\Users\kimconnect\Desktop\test\test1 C:\Users\kimconnect\Desktop\test\test2","C:\Users\kimconnect\Desktop\test\test2 C:\Users\kimconnect\Desktop\test\test3")$testPath="C:\Users\kimconnect\Desktop\test\test1"$switchesMirrorDirectories="/MIR /SEC /W:3 /FFT "$dateStamp = Get-Date -Format "yyyy-MM-dd-hh-mm"$currentPath=(Get-Item -Path ".\").FullName$log="/LOG+:$currentPath\robocopy-log-$dateStamp.txt"function…