Month: April 2021

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…

PowerShell: Check Active Directory Username Collisions

$originalCsvFile='C:\Users\rambo\Desktop\Usernames.csv' $newCsvFile='C:\Users\rambo\Desktop\Usernames-processed.csv' function checkUsernameCollisions($originalCsv,$newCsv){ $csvContents=import-csv $originalCsv write-host "Pulling existing records from Active Directory of $env:USERDNSDOMAIN..."…

PowerShell: Microsoft Dynamics Update All Organizations

# updateCrmOrgs.ps1 function updateCrmOrgs{ try{ Add-PSSnapin Microsoft.Crm.Powershell $servers=Get-CrmServer $highestVersion=($servers.Version|measure-object -Maximum).Maximum $lowVersionServers=$servers|?{[version]$_.Version -lt [version]$highestVersion} if($lowVersionServers){ write-warning…

PowerShell: Adding a New Domain Controller

Error when trying to run DCPROMO on a Windows 2019 Server: ---------------------------Active Directory Domain Services…

Windows Error When Joining Domain

Error Message: ---------------------------Computer Name/Domain Changes---------------------------Changing the Primary Domain DNS name of this computer to ""…