Month: July 2021

Setting Windows Security Auditing via Command Line

Please be advised that the follow auditpol cmdlet would be overridden by Group Policies in…

How To Turn On Windows SMB File Share Access Auditing

Step 1: Turn on File Editing Here is how to check for effective local group…

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…