Author: kimconnect

PowerShell: Get Event Logs from a List of Computers

Windows event logs contain a wealth of information that would be useful for analytical purposes.…

Redirecting Microphone through Remmina RDP Sessions

Update 11/29/2020: the 'redirect local microphone' option is now simply a check-mark on Remmina version…

PowerShell: Find Process ID (PID) Locking a Certain File

Here's a function to kill common processes (Antivirus executable excluded) locking a particular file. This…

Microsoft Dynamics Email Router Failed to Start

Symptoms Event Log: Item 1: highest correlating event ID 26234 #26234 - The Email Router…

PowerShell: Clear Windows Clipboard

Many of us are using Remote Desktop nowadays. As such, clipboard can sometimes be out…

How To Invoke Functions as Background Jobs

Invoke-Command, Start-Job, Multi-Tasking is what good coders should aspire toward. Here, we're looking at some…

PowerShell: Update a List of Multiple Windows Machines

Version 3: # updateWindowsList.ps1 # Version 0.0.3 # # Features: # - New feature over…

PowerShell: Output HashTable to CSV

function outputHashtableToCsv{ param( $hashTable, $csvFile='C:\updateResults.csv', $headers=@('computerName','minutesToUpdate') ) try{ write-host $($hashTable|out-string) if(test-path $csvFile){ rename-item $csvFile "$csvFile.bak"…

PowerShell: Combine Objects

By default, a PowerShell Custom Object cannot be added to another. This would be the…

PowerShell: Check Speculation Controls for Spectre Mitigation Support on Windows

Run the below function to view an output similar to this: BTIHardwarePresent : True ->…

PowerShell: Get Spectre Meltdown Patching Versions of Hyper-V Hosts

function getHyperVHostsInForest{ function includeRSAT{ $ErrorActionPreference='stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #$rsatWindows7x32='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x86-RefreshPkg.msu' $rsatWindows7x64='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x64-RefreshPkg.msu' $rsatWindows81='https://download.microsoft.com/download/1/8/E/18EA4843-C596-4542-9236-DE46F780806E/Windows8.1-KB2693643-x64.msu' $rsat1709 = "https://download.microsoft.com/download/1/D/8/1D8B5022-5477-4B9A-8104-6A71FF9D98AB/WindowsTH-RSAT_WS_1709-x64.msu" $rsat1803…

Ubuntu Linux: Unable to Write to a Mounted Media

Issue: Unable to create an object in a certain mounted media directory Resolution: Discover mounted…

Hyper-V Set CompatibilityForMigrationEnabled

$vmName='TESTVM' function enableCpuCompatibility($vmName){ $compatibilityForMigration=(Get-VMProcessor $vmName).CompatibilityForMigrationEnabled if(!$compatibilityForMigration){ $vmIsRunning=(get-vm $vmname).State -eq 'Running' if($vmIsRunning){stop-vm $vmName} Set-VMProcessor$vmName -CompatibilityForMigrationEnabled 1…

Hyper-V Live Migration Error 0x8007003B

Symptom: Live migration of 'Virtual Machine TESTVM' failed.Virtual machine migration operation for 'TESTVM' failed at…

PowerShell: Set Virtual Machine Default Paths on Hyper-V Host of a Cluster

$newVirtualMachinePath='D:\VirtualMachines' $newVirtualHardDiskPath='D:\VirtualMachines' function getHyperVHostsInForest{ function includeRSAT{ $ErrorActionPreference='stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #$rsatWindows7x32='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x86-RefreshPkg.msu' $rsatWindows7x64='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x64-RefreshPkg.msu' $rsatWindows81='https://download.microsoft.com/download/1/8/E/18EA4843-C596-4542-9236-DE46F780806E/Windows8.1-KB2693643-x64.msu' $rsat1709 =…

How To Change Default Backup Directory of Microsoft SQL Server

Option 1: Use the GUI Run Ssms.exe > login as sa > Right-click SQL Server…

PowerShell: Restore SQL Database from Full and/or Differential Backups

$databaseName='BALOO_MSCRM' $newDatabaseName='BALOO_MSCRM' $dbData='mscrm' # set this value to $null for autogen defaults $dbLog='mscrm_log' # set…

Microsoft SQL Cloning Database to a Different DB Name

# User defined variables $sourceSqlServer='DEV-SQL01' $sourceDatabaseName='TEST_MSCRM' $sourceSaCredential=$(get-credential) $destinationSqlServer='DEV-SQL01' $destinationDatabaseName='Test_MSCRM' $destinationSaCredential=$(get-credential) function copyDatabase{ param( $sourceSqlServer, $sourceDatabaseName,…

Microsoft Dynamics Audit History Data Missing After Org Migration

Issue: We have recently moved some Orgs from CRM version 8.x to 9.x, and audit…

Domain Controller Vulnerability Scan for ZeroLogon VCE-2000-1472

function vce2020-1472{ # Source: # Original script has been modified to fix a couple of…