Month: January 2022

T-SQL: Ad-hoc Commands to Backup All Databases

-- turn on Windows cmd shell EXEC sp_configure 'show advanced options', 1; GO RECONFIGURE; GO…

PowerShell: Windows Get-EventLog vs Get-WinEvent

Get-Eventlog is the legacy Windows log querying command. Its advanced filtering is limited. Whereas Get-WinEvent,…

Kubernetes Broken Due To Unknown Reasons

Problem 1: Admin User Unable to Login to Cluster via Controller (Master Node) # SSL…

PowerShell: Add and Remove a Registry Key

How to Add a Registry Key # Add New Registry Key $regHive='REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM' $keyname='OleDbTimeout' $value=600 Set-ItemProperty…

How to Repair Windows Corrupted System Files

Check for Corruptions # Check for corrupted system files Dism /Online /Cleanup-Image /ScanHealth [TESTWINDOWS001]: PS…

PowerShell: Set Service Startup Mode

# setServiceStartupMode.ps1 # Set auto start and restart upon failures $computernames=@( 'TESTWINDOWS001', 'TESTWINDOWS002' ) $serviceName='windows_exporter'…

PowerShell: Move Virtual Machine Storage Using VMM

# moveVmStorageUsingVmm.ps1 # Version 0.01 $vmNames=@( 'TESTVM0001', 'TESTVM0002', 'TESTVM0003' ) $storageLocations=@( 'C:\ClusterStorage\BLOB001', 'C:\ClusterStorage\BLOB002', 'C:\ClusterStorage\BLOB003' )…

PowerShell: Add Windows NTFS Permissions to File or Folder

The re-usable function: $path='C:\Windows\servicing' $accountsToAdd='Administrators' $permissions='Full' function addNtfsPermissions ($path,$accountsToAdd,$permissions){ $acl = Get-ACL $path $accessRule=New-Object System.Security.AccessControl.FileSystemAccessRule($accountsToAdd,$permissions,"Allow")…

Microsoft SQL Server Connection Timeout

Error Message: Resolution: a. Check SQL Server's Query Execution Timeout: SSMS > Login > Tools…

Search for Windows computers in a certain subnet using Active Directory

# Search for Windows computers in a certain subnet using Active Directory $subnetQuery='10.10' $filterString='2016' $computers=Get-ADComputer…

Remote Desktop Logon Error: ‘the user account used to connect to remote PC did not work

Symptom: The user account did not work error Resolution:In the instance that we've experienced, it…

Microsoft SQL Server Replication Setup Error Number MSSQL_REPL2110 and Resolution

Symptom: The distribution agent failed to create temporary files in 'C:\Program Files\Microsoft SQL Server\130\COM' directory…

Get Hyper-V Cluster Automatic Balancing Configurations

# getHyperVLoadBalanceMode.ps1 $clustername=(Get-Cluster).Name function getHyperVLoadBalanceMode($clustername=(Get-Cluster).Name){ $AutoBalancerLevel=[hashtable]@{ '1'='Low | Move when host is more than 80%…