Author: kimconnect

How To Setup ClamAV Antivirus Scanner in Kubernetes

Assumptions: A Kubernetes cluster is already setupThese are installed prior: Helm, MetalLB Load Balancer,A static…

PowerShell: Overcome Issues with Error 13932 in SCVMM When Refreshing Virtual Machines

Dealing with Clusters # refreshCluster.ps1 # Function to refresh a cluster in VMM in anticipation…

PowerShell: Try Catch Technique to Obtain Error Type

# Test try{Read-SCVirtualMachine $vmName -EA Stop}catch{$errorMessage=$error[0].Exception.GetType().FullNamewrite-host $errorMessage} # Get error type Microsoft.VirtualManager.Utils.CarmineException # Retry catch…

WordPress: Add Search Box Into Header

Navigate to Appearance > Theme Editor > select header.php > search for this section: <div…

PowerShell: Initiate Tests on Certain Ports

This appears to be a duplicate of another post. function initTestPort($portNumber=5985,$maxTests=3){ function getIndexDifference { param(…

PowerShell: How To Test A Server Ephemeral Port

# Setup a listening port on server # This session will automatically terminates after a…

Some Useful Windows Networking Commands

# Checking WinRM connections PS C:\Windows\system32> netstat -ano|select-string ":5985" TCP 0.0.0.0:5985 0.0.0.0:0 LISTENING 4 TCP…

PowerShell: Compare File Counts of 2 Directories

$folder1='C:\Temp' $folder2='C:\Temp2' $username=$null $password=$null function compareFileCounts{ param($folder1,$folder2,$mountAsUser,$mountAsPassword) function mountPathAsDrive($path,$driveLetter,$mountAsUser,$mountAsPassword){ function convertPathToUnc($path,$computername=$env:computername,$credentials=$null){ $pathIsUnc=$path -match '^\\\\' $pathIsReachable=if($credentials){test-path…

PowerShell: Query Google Account Using GAM

$emailAddress='[email protected]' $field='accounts:last_login_time' function getGamUser{ param( $emailAddress, $field ) $result=try{gam report users user $emailAddress}catch{} if($result){ $headers=$result[0]…

Moving a Domain Controller to a Different Geographical Location

Changing IP of a Domain Controller - If dcpromo has been done before the move…

PowerShell: Download and Expand Zip File – Legacy Compatible

function downloadFile{ param( $url, $tempFolder="C:\Temp" ) try{ $fileName=split-path $url -leaf $tempFile = "$tempFolder\$fileName" try{[Net.ServicePointManager]::SecurityProtocol =…

PowerShell: Disable Windows Hello

function disableWindowsHello{ $regHive='REGISTRY::HKLM\SOFTWARE\Policies\Microsoft\PassportForWork' $refreshEnv=$false if (!(Test-Path $regHive)){ Write-Host "Creating registry path $regHive" New-Item -Path $regHive…

Quick Snippet to Copy NTFS Permissions Between SMB Shares

The experimental script below will sync permissions of a folder toward another.WARNING: if sub-folders at…

How To Copy Folder in Legacy Windows with Long File Names?

$sourceDirectory='D:\SMBSHARE\LONGPATH' $destinationDirectory='\\FILESERVER\LONGPATH' function copyFolderWithLongNames($sourceDirectory,$destinationDirectory){ $sourceParent=split-path $sourceDirectory -parent $sourceChild=split-path $sourceDirectory -leaf $destinationParent=split-path $destinationDirectory -parent $destinationChild=split-path $destinationDirectory…

PowerShell: Expand Disk Volume to Maximum Size

# expandDisk.ps1 # version 0.02 $driveLetters=(Get-wmiobject win32_volume -filter 'DriveType=3 AND DriveLetter IS NOT NULL').DriveLetter function…

PowerShell: How to Change Active Directory Username

$oldUsername='testUser' $newUsername='tUser' function changeUsername{ param( $oldUsername, $newUsername ) $domainName=$env:USERDNSDOMAIN $newUserPrincipleName="$newUsername@$domainName" try{ Set-ADUser $oldUsername -SamAccountName $newUsername…

Converting from IOPS to MB/s

Conversion factors: from IOPS to MiB/s Throughput is a function of Input/Output per second (IOPS)…

Disable Windows 10 Automatic Updates

Why? It's annoying if Windows keep updating automatically in the background and even reboot when…

System Center Virtual Machine Manager Errors and Resolutions

Error Message: Error (415)Agent installation failed copying 'C:\Program Files\Microsoft System Center\Virtual Machine Manager\agents\I386\IRV-VMM01\msiInstaller.exe' to '\\IRV-HYPERV06\ADMIN$\msiInstaller.exe'.The…

PowerShell: Create, Edit User Accounts Basing on CSV File

# Create New Users: defined as names in CSV that does not exist in Existing…