Blog

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…

PowerShell: Create User Accounts From CSV File

# User-input Variables $csvFile='C:\Users-finalized.csv' $newOu='CN=Users,DC=kimconnect,DC=com' $newCompany='Kim Connect' $logFile="c:\temp\createActiveDirectoryAccounts-$(get-date -f yyyy-mm-dd-hh-mm-ss).txt" function createActiveDirectoryAccounts{ param( $csvFile, $newOu,…

PowerShell: Update Accounts Basing on CSV File

# adAccountsCsvUpdate.ps1 $originalCsvFile='C:\Users.csv' $newCsvFile='C:\Users-finalized.csv' $newEmailSuffix='@kimconnect.net' $newOu='CN=Users,DC=kimconnect,DC=com' function adAccountsCsvUpdate{ param( $originalCsvFile, $newCsvFile, $newEmailSuffix, $newOu ) function…

PowerShell: Export Event Logs by a Certain Date Range

# User defined variables $daysLimit=7 $startdate=(get-date).adddays(-$daysLimit) $computername=$env:computername $logName='Application' $filterTypes='Error','Warning' $logPath="c:\temp\eventlogs-from-$($startdate.tostring('yyyy-MM-dd'))-to-$((get-date).tostring('yyyy-MM-dd')).csv" # Get the event logs…

PowerShell: Backup Dynamics CRM Organization Database

# backupCrmOrgDatabase.ps1 # This script is to be invoked in the context of the Administrator…

PowerShell: Remove or Disable Windows Defender

$username='domain\serviceAccount' $password='PasswordHere' $encryptedPassword=ConvertTo-SecureString $password -AsPlainText -Force $credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $userName,$encryptedPassword; $computerNames=@( 'SERVER01',…

PowerShell: Windows Session Memory Usage Watcher

# windowsSessionWatcher.ps1 $serverNames=@( 'IRV-RDS01.domain1.net', 'LAX-RDS02.domain2.com ) $thresholdMemoryUsagePercent=30 $thresholdMemoryGb=20 $domainCreds=@( @{domain='domain1.ad';username='domain1\sysadmin';password=$env:pass1} @{domain='domain2.com';username='domain2\sysadmin';password=$env:pass2} ) # Email relay…

How to Fix Remote Desktop Blue Screen on Windows 2019

Problem: when an RDP session is idle for an extended period of time, that session…

PowerShell: Checking Duplicating Identifiers Among ADFS Relying Party Trusts

function getDuplicatingIfd{ write-host "Checking each relying party trust for any duplicates of identifiers..." $trusts=Get-AdfsRelyingPartyTrust $allTrustNames=$trusts.Name…

PowerShell: Connecting via WinRM with a Timeout

$credentials=get-credential $sessionTimeout=New-PSSessionOption -OpenTimeout 120000 # 2 minutes $sessionIncludePort=New-PSSessionOption -IncludePortInSPN -OpenTimeout 120000 $session=if($credentials){ try{ New-PSSession -ComputerName…

PowerShell: Check ADFS for Duplicate Identifiers

function checkDuplicateIdf{ write-host "Checking each relying party trust for any duplicates of identifiers..." $trusts=Get-AdfsRelyingPartyTrust $allTrustNames=$trusts.Name…

PowerShell: Creating Active Directory Accounts from CSV File

# User-input Variables $csvFile='C:\Users\rambo\Desktop\newUsers-finalized.csv' $newOu='CN=Users,DC=kimconnect,DC=com' $newCompany='KimConnect.com' $logFile="c:\temp\createActiveDirectoryAccounts-$(get-date -f yyyy-mm-dd-hh-mm-ss).txt" function createActiveDirectoryAccounts{ param( $csvFile, $newOu, $newCompany,…

PowerShell: Maintain Chocolatey Applications

This current version has some bugs... Review these other codes for some ideas on fixing...…

Add Chocolatey Private Repo

$privateRepo='kimconnectrepo' $privateRepoUrl='https://choco.kimconnect.net/chocolatey' $priority=1 # Set private repo source if it doesn't exist function addRepo{ param(…

PowerShell: Uninstalling an Application

$appname='Google Chrome' function uninstallApp($appName){ $alternativeMethod=$false try{ $app = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq $appName}…

PowerShell: Hyper-V Servers Capacity Report

Current Version: # HyperVCapacityReport.ps1 # Version 0.0.2 # Report parameters $workingDirectory='C:\scripts\googleSheets' $selectFields='node,model,os,cores,cpuUtilizationPercent,ramGb,ramUsedPercent' $domainObjects=@( @{domain='intranet.kimconnect.com';dc='lax-dc02.intranet.kimconnect.com';username='intranet\clusterReport';password=$env:clusterReportPass} @{domain='intranet.dragoncoin.com';dc='lax-dc02.intranet.dragoncoin.com';username='intranet\clusterReport';password=$env:clusterReportPass}…

PowerShell: Disable Microsoft Dynamics CRM Organization

# disableCrmOrganization.ps1 $orgname='testOrg' $domain='kimconnect.com' $dnsServer='10.10.10.10' $credentials=@{ 'kimconnect\crmAdmin'='password'; 'kimconnect\devAdmin'='password'; } $usernamePrefix='kimconnect\crm' $servernameSuffix='-app01' $ipDictionary=@{ 'dev01'='1.1.1.1'; 'prod01'='2.2.2.2'; }…

PowerShell: CredSSP

# Part 1: enable client mode on the local jump box $remoteComputer='SHERVER009' Enable-WSManCredSSP Client -DelegateComputer…